summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/CMakeLists.txt1
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp144
-rw-r--r--src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h84
-rw-r--r--src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp99
-rw-r--r--src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h78
-rw-r--r--src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp123
-rw-r--r--src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h80
-rw-r--r--src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp222
-rw-r--r--src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h92
-rw-r--r--src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp213
-rw-r--r--src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h87
-rw-r--r--src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp231
-rw-r--r--src/plugins/sensorgestures/qtsensors/qshake2recognizer.h116
-rw-r--r--src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp215
-rw-r--r--src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h100
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp113
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h68
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp193
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h98
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtsensors.pro37
-rw-r--r--src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp139
-rw-r--r--src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h80
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp291
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h96
-rw-r--r--src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp241
-rw-r--r--src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h100
-rw-r--r--src/plugins/sensorgestures/sensorgestures.pro2
-rw-r--r--src/plugins/sensorgestures/shake/qshakerecognizer.cpp160
-rw-r--r--src/plugins/sensorgestures/shake/qshakerecognizer.h98
-rw-r--r--src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp74
-rw-r--r--src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h65
-rw-r--r--src/plugins/sensorgestures/shake/shake.pro16
-rw-r--r--src/plugins/sensors/CMakeLists.txt30
-rw-r--r--src/plugins/sensors/android/CMakeLists.txt35
-rw-r--r--src/plugins/sensors/android/android.pro41
-rw-r--r--src/plugins/sensors/android/androidaccelerometer.cpp40
-rw-r--r--src/plugins/sensors/android/androidaccelerometer.h40
-rw-r--r--src/plugins/sensors/android/androidcompass.cpp40
-rw-r--r--src/plugins/sensors/android/androidcompass.h40
-rw-r--r--src/plugins/sensors/android/androidgyroscope.cpp40
-rw-r--r--src/plugins/sensors/android/androidgyroscope.h40
-rw-r--r--src/plugins/sensors/android/androidlight.cpp40
-rw-r--r--src/plugins/sensors/android/androidlight.h40
-rw-r--r--src/plugins/sensors/android/androidmagnetometer.cpp40
-rw-r--r--src/plugins/sensors/android/androidmagnetometer.h40
-rw-r--r--src/plugins/sensors/android/androidpressure.cpp40
-rw-r--r--src/plugins/sensors/android/androidpressure.h40
-rw-r--r--src/plugins/sensors/android/androidproximity.cpp42
-rw-r--r--src/plugins/sensors/android/androidproximity.h42
-rw-r--r--src/plugins/sensors/android/androidrotation.cpp81
-rw-r--r--src/plugins/sensors/android/androidrotation.h40
-rw-r--r--src/plugins/sensors/android/androidtemperature.cpp40
-rw-r--r--src/plugins/sensors/android/androidtemperature.h40
-rw-r--r--src/plugins/sensors/android/main.cpp58
-rw-r--r--src/plugins/sensors/android/sensoreventqueue.h43
-rw-r--r--src/plugins/sensors/android/sensormanager.cpp80
-rw-r--r--src/plugins/sensors/android/sensormanager.h57
-rw-r--r--src/plugins/sensors/dummy/CMakeLists.txt30
-rw-r--r--src/plugins/sensors/dummy/dummy.pro19
-rw-r--r--src/plugins/sensors/dummy/dummyaccelerometer.cpp40
-rw-r--r--src/plugins/sensors/dummy/dummyaccelerometer.h40
-rw-r--r--src/plugins/sensors/dummy/dummycommon.cpp42
-rw-r--r--src/plugins/sensors/dummy/dummycommon.h40
-rw-r--r--src/plugins/sensors/dummy/dummylightsensor.cpp40
-rw-r--r--src/plugins/sensors/dummy/dummylightsensor.h40
-rw-r--r--src/plugins/sensors/dummy/main.cpp44
-rw-r--r--src/plugins/sensors/generic/CMakeLists.txt36
-rw-r--r--src/plugins/sensors/generic/generic.pro29
-rw-r--r--src/plugins/sensors/generic/genericalssensor.cpp40
-rw-r--r--src/plugins/sensors/generic/genericalssensor.h40
-rw-r--r--src/plugins/sensors/generic/genericorientationsensor.cpp40
-rw-r--r--src/plugins/sensors/generic/genericorientationsensor.h40
-rw-r--r--src/plugins/sensors/generic/genericrotationsensor.cpp40
-rw-r--r--src/plugins/sensors/generic/genericrotationsensor.h40
-rw-r--r--src/plugins/sensors/generic/generictiltsensor.cpp42
-rw-r--r--src/plugins/sensors/generic/generictiltsensor.h40
-rw-r--r--src/plugins/sensors/generic/main.cpp77
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt50
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro31
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h42
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/main.cpp54
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml2
-rw-r--r--src/plugins/sensors/ios/CMakeLists.txt59
-rw-r--r--src/plugins/sensors/ios/ios.pro49
-rw-r--r--src/plugins/sensors/ios/iosaccelerometer.h40
-rw-r--r--src/plugins/sensors/ios/iosaccelerometer.mm40
-rw-r--r--src/plugins/sensors/ios/ioscompass.h40
-rw-r--r--src/plugins/sensors/ios/ioscompass.mm40
-rw-r--r--src/plugins/sensors/ios/iosgyroscope.h40
-rw-r--r--src/plugins/sensors/ios/iosgyroscope.mm40
-rw-r--r--src/plugins/sensors/ios/iosmagnetometer.h40
-rw-r--r--src/plugins/sensors/ios/iosmagnetometer.mm44
-rw-r--r--src/plugins/sensors/ios/iosmotionmanager.h40
-rw-r--r--src/plugins/sensors/ios/iosmotionmanager.mm40
-rw-r--r--src/plugins/sensors/ios/iospressure.h37
-rw-r--r--src/plugins/sensors/ios/iospressure.mm65
-rw-r--r--src/plugins/sensors/ios/iosproximitysensor.h40
-rw-r--r--src/plugins/sensors/ios/iosproximitysensor.mm40
-rw-r--r--src/plugins/sensors/ios/main.mm55
-rw-r--r--src/plugins/sensors/linux/linux.pro13
-rw-r--r--src/plugins/sensors/linux/linuxsysaccelerometer.cpp188
-rw-r--r--src/plugins/sensors/linux/linuxsysaccelerometer.h74
-rw-r--r--src/plugins/sensors/linux/main.cpp72
-rw-r--r--src/plugins/sensors/linux/plugin.json1
-rw-r--r--src/plugins/sensors/sensorfw/CMakeLists.txt38
-rw-r--r--src/plugins/sensors/sensorfw/main.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfw.pro16
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwaccelerometer.h44
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwals.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwals.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwcompass.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwcompass.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwgyroscope.h45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlidsensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwlightsensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp47
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwmagnetometer.h45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfworientationsensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwproximitysensor.h40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp45
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwrotationsensor.h43
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp47
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwsensorbase.h42
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp40
-rw-r--r--src/plugins/sensors/sensorfw/sensorfwtapsensor.h40
-rw-r--r--src/plugins/sensors/sensors.pro45
-rw-r--r--src/plugins/sensors/sensortag/Sensors.conf13
-rw-r--r--src/plugins/sensors/sensortag/main.cpp113
-rw-r--r--src/plugins/sensors/sensortag/plugin.json1
-rw-r--r--src/plugins/sensors/sensortag/sensortag.pri22
-rw-r--r--src/plugins/sensors/sensortag/sensortag.pro11
-rw-r--r--src/plugins/sensors/sensortag/sensortagaccelerometer.cpp82
-rw-r--r--src/plugins/sensors/sensortag/sensortagaccelerometer.h68
-rw-r--r--src/plugins/sensors/sensortag/sensortagals.cpp97
-rw-r--r--src/plugins/sensors/sensortag/sensortagals.h68
-rw-r--r--src/plugins/sensors/sensortag/sensortagbase.cpp600
-rw-r--r--src/plugins/sensors/sensortag/sensortagbase.h252
-rw-r--r--src/plugins/sensors/sensortag/sensortaggyroscope.cpp84
-rw-r--r--src/plugins/sensors/sensortag/sensortaggyroscope.h67
-rw-r--r--src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp74
-rw-r--r--src/plugins/sensors/sensortag/sensortaghumiditysensor.h62
-rw-r--r--src/plugins/sensors/sensortag/sensortaglightsensor.cpp78
-rw-r--r--src/plugins/sensors/sensortag/sensortaglightsensor.h66
-rw-r--r--src/plugins/sensors/sensortag/sensortagmagnetometer.cpp80
-rw-r--r--src/plugins/sensors/sensortag/sensortagmagnetometer.h69
-rw-r--r--src/plugins/sensors/sensortag/sensortagpressuresensor.cpp73
-rw-r--r--src/plugins/sensors/sensortag/sensortagpressuresensor.h65
-rw-r--r--src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp73
-rw-r--r--src/plugins/sensors/sensortag/sensortagtemperaturesensor.h62
-rw-r--r--src/plugins/sensors/simulator/main.cpp143
-rw-r--r--src/plugins/sensors/simulator/plugin.json1
-rw-r--r--src/plugins/sensors/simulator/qsensordata_simulator.cpp143
-rw-r--r--src/plugins/sensors/simulator/qsensordata_simulator_p.h128
-rw-r--r--src/plugins/sensors/simulator/simulator.pro32
-rw-r--r--src/plugins/sensors/simulator/simulatoraccelerometer.cpp71
-rw-r--r--src/plugins/sensors/simulator/simulatoraccelerometer.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorambientlightsensor.cpp89
-rw-r--r--src/plugins/sensors/simulator/simulatorambientlightsensor.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorcommon.cpp252
-rw-r--r--src/plugins/sensors/simulator/simulatorcommon.h105
-rw-r--r--src/plugins/sensors/simulator/simulatorcompass.cpp69
-rw-r--r--src/plugins/sensors/simulator/simulatorcompass.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorirproximitysensor.cpp67
-rw-r--r--src/plugins/sensors/simulator/simulatorirproximitysensor.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorlightsensor.cpp67
-rw-r--r--src/plugins/sensors/simulator/simulatorlightsensor.h59
-rw-r--r--src/plugins/sensors/simulator/simulatormagnetometer.cpp73
-rw-r--r--src/plugins/sensors/simulator/simulatormagnetometer.h59
-rw-r--r--src/plugins/sensors/simulator/simulatorproximitysensor.cpp67
-rw-r--r--src/plugins/sensors/simulator/simulatorproximitysensor.h59
-rw-r--r--src/plugins/sensors/winrt/CMakeLists.txt32
-rw-r--r--src/plugins/sensors/winrt/main.cpp63
-rw-r--r--src/plugins/sensors/winrt/winrt.pro27
-rw-r--r--src/plugins/sensors/winrt/winrtaccelerometer.cpp87
-rw-r--r--src/plugins/sensors/winrt/winrtaccelerometer.h40
-rw-r--r--src/plugins/sensors/winrt/winrtambientlightsensor.cpp84
-rw-r--r--src/plugins/sensors/winrt/winrtambientlightsensor.h40
-rw-r--r--src/plugins/sensors/winrt/winrtcommon.cpp40
-rw-r--r--src/plugins/sensors/winrt/winrtcommon.h40
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.cpp86
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.h40
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.cpp88
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.h42
-rw-r--r--src/plugins/sensors/winrt/winrtorientationsensor.cpp83
-rw-r--r--src/plugins/sensors/winrt/winrtorientationsensor.h40
-rw-r--r--src/plugins/sensors/winrt/winrtrotationsensor.cpp85
-rw-r--r--src/plugins/sensors/winrt/winrtrotationsensor.h42
203 files changed, 919 insertions, 12404 deletions
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
new file mode 100644
index 00000000..64b9584e
--- /dev/null
+++ b/src/plugins/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(sensors)
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
deleted file mode 100644
index c8b9e6ab..00000000
--- a/src/plugins/plugins.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += sensors
-SUBDIRS += sensorgestures
diff --git a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
deleted file mode 100644
index 6bb65e9f..00000000
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,144 +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 "qcoversensorgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-QCoverSensorGestureRecognizer::QCoverSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent),
- orientationReading(0),
- proximityReading(0),
- timer(0),
- active(0),
- detecting(0)
-{
-}
-
-QCoverSensorGestureRecognizer::~QCoverSensorGestureRecognizer()
-{
-}
-
-void QCoverSensorGestureRecognizer::create()
-{
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),this,SLOT(timeout()));
- timer->setSingleShot(true);
- timer->setInterval(750);
-}
-
-QString QCoverSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.cover");
-}
-
-bool QCoverSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Proximity)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- active = false;
- }
- } else {
- active = false;
- }
- return active;
-}
-
-bool QCoverSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- active = false;
- timer->stop();
- return active;
-}
-
-bool QCoverSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QCoverSensorGestureRecognizer::proximityChanged(QProximityReading *reading)
-{
- if (orientationReading == 0)
- return;
-
- proximityReading = reading->close();
-
- // look at case of face up->face down->face up.
- if (orientationReading->orientation() == QOrientationReading::FaceUp
- && proximityReading) {
- if (!timer->isActive()) {
- timer->start();
- detecting = true;
- }
- }
-}
-
-void QCoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-void QCoverSensorGestureRecognizer::timeout()
-{
- if ((orientationReading->orientation() == QOrientationReading::FaceUp)
- && proximityReading) {
- Q_EMIT cover();
- Q_EMIT detected("cover");
- detecting = false;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
deleted file mode 100644
index d9c57e80..00000000
--- a/src/plugins/sensorgestures/qtsensors/qcoversensorgesturerecognizer.h
+++ /dev/null
@@ -1,84 +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 QCOVERSENSORGESTURERECOGNIZER_H
-#define QCOVERSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QTimer>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QCoverSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QCoverSensorGestureRecognizer(QObject *parent = 0);
- ~QCoverSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void cover();
-
-private slots:
- void proximityChanged(QProximityReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void timeout();
-
-private:
-
- QOrientationReading *orientationReading;
- bool proximityReading;
-
- QTimer *timer;
- bool active;
- bool detecting;
-};
-
-QT_END_NAMESPACE
-#endif // QCOVERSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp
deleted file mode 100644
index 6d765a1a..00000000
--- a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,99 +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 <QtSensors/QTapSensor>
-#include "qdoubletapsensorgesturerecognizer.h"
-QT_BEGIN_NAMESPACE
-
-QDoubleTapSensorGestureRecognizer::QDoubleTapSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent)
- , active(0)
-{
-}
-
-QDoubleTapSensorGestureRecognizer::~QDoubleTapSensorGestureRecognizer()
-{
-}
-
-void QDoubleTapSensorGestureRecognizer::create()
-{
-}
-
-
-QString QDoubleTapSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.doubletap");
-}
-
-bool QDoubleTapSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Tap)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(dTabReadingChanged(QTapReading*)),
- this,SLOT(tapChanged(QTapReading*)));
- } else {
- active = false;
- }
- return active;
-}
-
-bool QDoubleTapSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Tap);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(dTabReadingChanged(QTapReading*)),
- this,SLOT(tapChanged(QTapReading*)));
- active = false;
- return active;
-}
-
-bool QDoubleTapSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QDoubleTapSensorGestureRecognizer::tapChanged(QTapReading *reading)
-{
- if (reading->isDoubleTap()) {
- Q_EMIT doubletap();
- Q_EMIT detected("doubletap");
- }
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h
deleted file mode 100644
index 73d7db56..00000000
--- a/src/plugins/sensorgestures/qtsensors/qdoubletapsensorgesturerecognizer.h
+++ /dev/null
@@ -1,78 +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 QDOUBLETAPSENSORGESTURERECOGNIZER_H
-#define QDOUBLETAPSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/QSensor>
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QtSensors/QTapSensor>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QDoubleTapSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QDoubleTapSensorGestureRecognizer(QObject *parent = 0);
- ~QDoubleTapSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void doubletap();
-
-private slots:
- void tapChanged(QTapReading *reading);
-
-private:
- QTapSensor *tapSensor;
- bool active;
-
-};
-QT_END_NAMESPACE
-#endif // QDOUBLETAPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp
deleted file mode 100644
index d158e1f0..00000000
--- a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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 <qmath.h>
-
-#include "qfreefallsensorgesturerecognizer.h"
-
-QT_BEGIN_NAMESPACE
-
-QFreefallSensorGestureRecognizer::QFreefallSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , active(0)
- , detecting(0)
-{
-}
-
-QFreefallSensorGestureRecognizer::~QFreefallSensorGestureRecognizer()
-{
-}
-
-void QFreefallSensorGestureRecognizer::create()
-{
-}
-
-QString QFreefallSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.freefall");
-}
-
-bool QFreefallSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- active = false;
- }
- return active;
-
-}
-
-bool QFreefallSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
-
- return active;
-}
-
-bool QFreefallSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-#define FREEFALL_THRESHOLD 1.0
-#define LANDED_THRESHOLD 20.0
-#define FREEFALL_MAX 4
-
-void QFreefallSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
- qreal sum = qSqrt(x * x + y * y + z * z);
-
- if (qAbs(sum) < FREEFALL_THRESHOLD) {
- detecting = true;
- freefallList.append(sum);
- } else {
- if (detecting && qAbs(sum) > LANDED_THRESHOLD) {
- Q_EMIT landed();
- Q_EMIT detected("landed");
- freefallList.clear();
- }
- }
-
- if (freefallList.count() > FREEFALL_MAX) {
- Q_EMIT freefall();
- Q_EMIT detected("freefall");
- }
-}
-
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h
deleted file mode 100644
index 124475ad..00000000
--- a/src/plugins/sensorgestures/qtsensors/qfreefallsensorgesturerecognizer.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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 QFREEFALLSENSORGESTURERECOGNIZER_H
-#define QFREEFALLSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QFreefallSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QFreefallSensorGestureRecognizer(QObject *parent = 0);
- ~QFreefallSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void freefall();
- void landed();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
-
-private:
-
- bool active;
- bool detecting;
- QList <qreal> freefallList;
-
-};
-QT_END_NAMESPACE
-#endif // QPICKUPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp
deleted file mode 100644
index 9a1fa1c5..00000000
--- a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,222 +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 "qhoversensorgesturerecognizer.h"
-#include <math.h>
-
-#define TIMER2_TIMEOUT 5000
-
-QT_BEGIN_NAMESPACE
-
-QHoverSensorGestureRecognizer::QHoverSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- orientationReading(0),reflectance(0),
- hoverOk(0), detecting(0), active(0), initialReflectance(0), useHack(0),
- lastTimestamp(0), timer2Active(0), lapsedTime2(0)
-{
-}
-
-QHoverSensorGestureRecognizer::~QHoverSensorGestureRecognizer()
-{
-}
-
-void QHoverSensorGestureRecognizer::create()
-{
-
-}
-
-QString QHoverSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.hover");
-}
-
-bool QHoverSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::IrProximity)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(irProximityReadingChanged(QIRProximityReading*)),
- this,SLOT(irProximityReadingChanged(QIRProximityReading*)));
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::IrProximity);
- active = false;
- }
- } else {
- active = false;
- }
-
- detecting = false;
- detectedHigh = 0;
- initialReflectance = 0;
- useHack = false;
- timer2Active = false;
- lapsedTime2 = 0;
- return active;
-}
-
-bool QHoverSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::IrProximity);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(irProximityReadingChanged(QIRProximityReading*)),
- this,SLOT(irProximityReadingChanged(QIRProximityReading*)));
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- active = false;
- timer2Active = false;
- initialReflectance = 0;
- return active;
-}
-
-bool QHoverSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-
-void QHoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-void QHoverSensorGestureRecognizer::irProximityReadingChanged(QIRProximityReading *reading)
-{
- reflectance = reading->reflectance();
- if (reflectance == 0)
- return;
-
- if (initialReflectance == 0) {
- initialReflectance = reflectance;
- }
-
- if (initialReflectance > .2) {
- useHack = true;
- initialReflectance -= .1;
- }
- if (useHack)
- reflectance -= .1;
-
- if (detecting && !hoverOk) {
- detectedHigh = qMax(detectedHigh, reflectance);
- }
-
- if (reflectance > 0.4) {
- // if close stop detecting
- hoverOk = false;
- detecting = false;
- detectedHigh = 0;
- }
-
- qreal detectedPercent = 100 - (detectedHigh / reflectance * 100);
-
- qint16 percentCheck;
- if (useHack)
- percentCheck = -60;
- else
- percentCheck = -101;
-
- quint64 timestamp = reading->timestamp();
-
- if (!detecting
- && checkForHovering()) {
- detecting = true;
- detecting = true;
- timer2Active = true;
- detectedHigh = reflectance;
- } else if (detecting
- && detectedPercent < percentCheck
- && !checkForHovering()) {
- // went light again after 1 seconds
- Q_EMIT hover();
- Q_EMIT detected("hover");
- hoverOk = false;
- detecting = false;
- detectedHigh = 0;
- timer2Active = false;;
- }
- if (detecting && reflectance < 0.2) {
- timeout();
- }
- if (timer2Active && lastTimestamp > 0)
- lapsedTime2 += (timestamp - lastTimestamp )/1000;
-
- if (timer2Active && lapsedTime2 >= TIMER2_TIMEOUT) {
- timeout2();
- }
-
- lastTimestamp = reading->timestamp();
-}
-
-bool QHoverSensorGestureRecognizer::checkForHovering()
-{
- if (orientationReading == 0) {
- return false;
- }
- if (orientationReading->orientation() != QOrientationReading::FaceUp)
- return false;
- if ( (reflectance > 0.2 && reflectance < 0.4)
- && (initialReflectance - reflectance) < -0.1)
- return true;
-
- return false;
-}
-
-
-void QHoverSensorGestureRecognizer::timeout()
-{
- if (checkForHovering()) {
- hoverOk = true;
- timer2Active = true;
- } else {
- detecting = false;
- detectedHigh = 0;
- }
-}
-
-void QHoverSensorGestureRecognizer::timeout2()
-{
- detecting = false;
- hoverOk = false;
- detectedHigh = 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h
deleted file mode 100644
index d0c8f706..00000000
--- a/src/plugins/sensorgestures/qtsensors/qhoversensorgesturerecognizer.h
+++ /dev/null
@@ -1,92 +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 QHOVERSENSORGESTURERECOGNIZER_H
-#define QHOVERSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/QSensorGestureRecognizer>
-
-#include "qtsensorgesturesensorhandler.h"
-
-
-QT_BEGIN_NAMESPACE
-
-class QHoverSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QHoverSensorGestureRecognizer(QObject *parent = 0);
- ~QHoverSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void hover();
-
-private slots:
- void orientationReadingChanged(QOrientationReading *reading);
- void irProximityReadingChanged(QIRProximityReading *reading);
- void timeout();
- void timeout2();
-private:
- QOrientationReading *orientationReading;
- qreal reflectance;
- bool hoverOk;
- bool detecting;
-
- qreal detectedHigh;
- bool active;
- qreal initialReflectance;
- bool checkForHovering();
- bool useHack;
-
- quint64 lastTimestamp;
-
- bool timer2Active;
- quint64 lapsedTime2;
-
-};
-QT_END_NAMESPACE
-#endif // QHOVERSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
deleted file mode 100644
index 33688706..00000000
--- a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,213 +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 "qpickupsensorgesturerecognizer.h"
-
-#include <QtCore/qmath.h>
-
-#define TIMER_TIMEOUT 250
-
-QT_BEGIN_NAMESPACE
-
-QPickupSensorGestureRecognizer::QPickupSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , accelReading(0)
- , active(0)
- , pXaxis(0)
- , pYaxis(0)
- , pZaxis(0)
- , lastpitch(0)
- , detecting(0)
-{
-}
-
-QPickupSensorGestureRecognizer::~QPickupSensorGestureRecognizer()
-{
-}
-
-void QPickupSensorGestureRecognizer::create()
-{
-}
-
-QString QPickupSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.pickup");
-}
-
-bool QPickupSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- clear();
-
- return active;
-
-}
-
-bool QPickupSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
-
- return active;
-}
-
-bool QPickupSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-#define PICKUP_BOTTOM_THRESHOLD 25
-#define PICKUP_TOP_THRESHOLD 80
-#define PICKUP_ANGLE_THRESHOLD 25
-#define PICKUP_ROLL_THRESHOLD 13
-
-void QPickupSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- accelReading = reading;
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
- const qreal xdiff = pXaxis - x;
- const qreal ydiff = pYaxis - y;
- const qreal zdiff = pZaxis - z;
-
- qreal pitch = qRadiansToDegrees(qAtan(y / qSqrt(x * x + z * z)));
- qreal roll = qRadiansToDegrees(qAtan(x / qSqrt(y * y + z * z)));
-
- if ((qAbs(xdiff) < 0.7 && qAbs(ydiff) < .7 && qAbs(zdiff) < .7)
- || z < 0) {
- detecting = false;
- } else if (pitch > PICKUP_BOTTOM_THRESHOLD && pitch < PICKUP_TOP_THRESHOLD) {
- detecting = true;
- }
-
- if ( pitchList.count() > 21) {
- pitchList.removeFirst();
- }
- if ( rollList.count() > 21) {
- rollList.removeFirst();
- }
-
- if (pitch > 1) {
- pitchList.append(pitch);
- }
- if (roll > 1) {
- rollList.append(roll);
- }
-
- if (detecting && pitchList.count() > 5 ) {
- timeout();
- }
-
- lastpitch = pitch;
- pXaxis = x;
- pYaxis = y;
- pZaxis = z;
-}
-
-void QPickupSensorGestureRecognizer::timeout()
-{
- qreal averageRoll = 0;
- for (int r = 0; r < rollList.count(); r++) {
- averageRoll += rollList.at(r);
- }
- averageRoll /= rollList.count();
-
- if (averageRoll > PICKUP_ROLL_THRESHOLD) {
- clear();
- return;
- }
- if (pitchList.isEmpty()
- || pitchList.at(0) > PICKUP_BOTTOM_THRESHOLD) {
- clear();
- return;
- }
-
- qreal previousPitch = 0;
- qreal startPitch = -1.0;
- int goodCount = 0;
-
- qreal averagePitch = 0;
- for (int i = 0; i < pitchList.count(); i++) {
- averagePitch += pitchList.at(i);
- if (previousPitch < pitchList.at(i)
- && qAbs(pitchList.at(i)) - qAbs(previousPitch) < 20) {
- if (goodCount == 1 && previousPitch != 0) {
- startPitch = previousPitch;
- }
- goodCount++;
- }
-
- previousPitch = pitchList.at(i);
- }
- averagePitch /= pitchList.count();
-
- if (averagePitch < 5) {
- clear();
- return;
- }
-
- if (goodCount >= 3 &&
- (pitchList.last() < PICKUP_TOP_THRESHOLD
- && pitchList.last() > PICKUP_BOTTOM_THRESHOLD)
- && startPitch > 0
- && (pitchList.last() - startPitch) > PICKUP_ANGLE_THRESHOLD) {
- Q_EMIT pickup();
- Q_EMIT detected("pickup");
- }
- clear();
-}
-
-void QPickupSensorGestureRecognizer::clear()
-{
- pitchList.clear();
- detecting = false;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h
deleted file mode 100644
index fdc0a6fe..00000000
--- a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.h
+++ /dev/null
@@ -1,87 +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 QPICKUPSENSORGESTURERECOGNIZER_H
-#define QPICKUPSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPickupSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QPickupSensorGestureRecognizer(QObject *parent = 0);
- ~QPickupSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void pickup();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
-
- void timeout();
-private:
- QAccelerometerReading *accelReading;
-
- bool active;
- qreal pXaxis;
- qreal pYaxis;
- qreal pZaxis;
-
- qreal lastpitch;
- bool detecting;
-
- QList <qreal> pitchList;
- QList <qreal> rollList;
-
- void clear();
-};
-QT_END_NAMESPACE
-#endif // QPICKUPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
deleted file mode 100644
index 16313b41..00000000
--- a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.cpp
+++ /dev/null
@@ -1,231 +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 <QDebug>
-
-#include "qshake2recognizer.h"
-#include <math.h>
-
-
-QT_BEGIN_NAMESPACE
-
-QShake2SensorGestureRecognizer::QShake2SensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , active(0)
- , shakeDirection(QShake2SensorGestureRecognizer::ShakeUndefined)
- , shaking(0)
- , shakeCount(0)
- , lapsedTime(0)
- , lastTimestamp(0),
- timerActive(0)
-{
- timerTimeout = 250;
-}
-
-QShake2SensorGestureRecognizer::~QShake2SensorGestureRecognizer()
-{
-}
-
-void QShake2SensorGestureRecognizer::create()
-{
-}
-
-bool QShake2SensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- active = false;
- }
- prevData.x = 0;
- prevData.y = 0;
- prevData.z = 0;
- shakeCount = 0;
- shaking = false;
- shakeDirection = QShake2SensorGestureRecognizer::ShakeUndefined;
-
- return active;
-}
-
-bool QShake2SensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
- return active;
-}
-
-bool QShake2SensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-QString QShake2SensorGestureRecognizer::id() const
-{
- return QString("QtSensors.shake2");
-}
-
-#define NUMBER_SHAKES 3
-#define THRESHOLD 25
-
-void QShake2SensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
-
- const quint64 timestamp = reading->timestamp();
-
- currentData.x = x;
- currentData.y = y;
- currentData.z = z;
-
- if (qAbs(prevData.x - currentData.x) < 1
- && qAbs(prevData.y - currentData.y) < 1
- && qAbs(prevData.z - currentData.z) < 1) {
-
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
- return;
- }
-
- bool wasShake;
- wasShake = checkForShake(prevData, currentData, THRESHOLD);
-
- if (!shaking && wasShake &&
- shakeCount == NUMBER_SHAKES) {
- shaking = true;
- shakeCount = 0;
- lapsedTime = 0;
- timerActive = false;
- switch (shakeDirection) {
- case QShake2SensorGestureRecognizer::ShakeLeft:
- Q_EMIT shakeLeft();
- Q_EMIT detected("shakeLeft");
- break;
- case QShake2SensorGestureRecognizer::ShakeRight:
- Q_EMIT shakeRight();
- Q_EMIT detected("shakeRight");
- break;
- case QShake2SensorGestureRecognizer::ShakeUp:
- Q_EMIT shakeUp();
- Q_EMIT detected("shakeUp");
- break;
- case QShake2SensorGestureRecognizer::ShakeDown:
- Q_EMIT shakeDown();
- Q_EMIT detected("shakeDown");
- break;
- default:
- break;
- };
-
- } else if (wasShake) {
-
- if (shakeCount == 0 && shakeDirection == QShake2SensorGestureRecognizer::ShakeUndefined) {
-
- const int xdiff = prevData.x - currentData.x;
- const int ydiff = prevData.x - currentData.y;
-
- const int max = qMax(qAbs(ydiff), qAbs(xdiff));
- if (max == qAbs(xdiff)) {
- if (isNegative(xdiff))
- shakeDirection = QShake2SensorGestureRecognizer::ShakeLeft;
- else
- shakeDirection = QShake2SensorGestureRecognizer::ShakeRight;
-
- } else if (max == qAbs(ydiff)) {
- if (isNegative(ydiff))
- shakeDirection = QShake2SensorGestureRecognizer::ShakeDown;
- else
- shakeDirection = QShake2SensorGestureRecognizer::ShakeUp;
- }
- }
- shakeCount++;
- if (shakeCount == NUMBER_SHAKES) {
- timerActive = true;
- }
- }
-
- if (timerActive && lastTimestamp > 0)
- lapsedTime += (timestamp - lastTimestamp )/1000;
-
- if (timerActive && lapsedTime >= timerTimeout) {
- timeout();
- }
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
- lastTimestamp = timestamp;
-}
-
-void QShake2SensorGestureRecognizer::timeout()
-{
- shakeCount = 0;
- shaking = false;
- shakeDirection = QShake2SensorGestureRecognizer::ShakeUndefined;
- timerActive = false;
- lapsedTime = 0;
- lastTimestamp = 0;
-}
-
-bool QShake2SensorGestureRecognizer::checkForShake(ShakeData prevSensorData, ShakeData currentSensorData, qreal threshold)
-{
- const double deltaX = qAbs(prevSensorData.x - currentSensorData.x);
- const double deltaY = qAbs(prevSensorData.y - currentSensorData.y);
- const double deltaZ = qAbs(prevSensorData.z - currentSensorData.z);
-
- return (deltaX > threshold
- || deltaY > threshold
- || deltaZ > threshold);
-}
-
-bool QShake2SensorGestureRecognizer::isNegative(qreal num)
-{
- if (num < 0)
- return true;
- return false;
-}
-
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.h b/src/plugins/sensorgestures/qtsensors/qshake2recognizer.h
deleted file mode 100644
index 9e402cf6..00000000
--- a/src/plugins/sensorgestures/qtsensors/qshake2recognizer.h
+++ /dev/null
@@ -1,116 +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 QSHAKERECOGNIZER_H
-#define QSHAKERECOGNIZER_H
-
-#include <QDebug>
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-struct ShakeData {
- qreal x;
- qreal y;
- qreal z;
-};
-
-class QShake2SensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-
-public:
-
- enum ShakeDirection {
- ShakeUndefined = 0,
- ShakeLeft,
- ShakeRight,
- ShakeUp,
- ShakeDown
- };
-
- QShake2SensorGestureRecognizer(QObject *parent = 0);
- ~QShake2SensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
- int timerTimeout;
-
-
-Q_SIGNALS:
- void shakeLeft();
- void shakeRight();
- void shakeUp();
- void shakeDown();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void timeout();
-
-
-private:
- QAccelerometerReading *accelReading;
-
- bool active;
-
- ShakeDirection shakeDirection;
-
- ShakeData prevData;
- ShakeData currentData;
-
- bool checkForShake(ShakeData prevSensorData, ShakeData currentSensorData, qreal threshold);
- bool shaking;
- int shakeCount;
- int threshold;
-
- bool isNegative(qreal num);
- qreal lapsedTime;
- quint64 lastTimestamp;
- bool timerActive;
-};
-QT_END_NAMESPACE
-#endif // QSHAKERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp
deleted file mode 100644
index 658f81eb..00000000
--- a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.cpp
+++ /dev/null
@@ -1,215 +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 "qslamgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-QSlamSensorGestureRecognizer::QSlamSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- orientationReading(0),
- accelRange(0),
- active(0),
- lastX(0),
- lastY(0),
- lastZ(0),
- detectedX(0),
- detecting(0),
- accelX(0),
- roll(0),
- resting(0),
- lastTimestamp(0),
- lapsedTime(0),
- timerActive(0)
-{
-}
-
-QSlamSensorGestureRecognizer::~QSlamSensorGestureRecognizer()
-{
-}
-
-void QSlamSensorGestureRecognizer::create()
-{
-}
-
-
-QString QSlamSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.slam");
-}
-
-bool QSlamSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- accelRange = QtSensorGestureSensorHandler::instance()->accelRange;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- } else {
- active = false;
- }
- return active;
-}
-
-bool QSlamSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- detecting = false;
- restingList.clear();
- active = false;
- return active;
-}
-
-bool QSlamSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QSlamSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-#define SLAM_DETECTION_FACTOR 0.3 // 11.7
-#define SLAM_RESTING_FACTOR 2.5
-#define SLAM_RESTING_COUNT 5
-#define SLAM_ZERO_FACTOR .02
-
-void QSlamSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
- quint64 timestamp = reading->timestamp();
-
- if (qAbs(lastX - x) < SLAM_RESTING_FACTOR
- && qAbs(lastY - y) < SLAM_RESTING_FACTOR
- && qAbs(lastZ - z) < SLAM_RESTING_FACTOR) {
- resting = true;
- } else {
- resting = false;
- }
-
- if (restingList.count() > SLAM_RESTING_COUNT)
- restingList.removeLast();
- restingList.insert(0, resting);
-
-
- if (timerActive && lastTimestamp > 0)
- lapsedTime += (timestamp - lastTimestamp )/1000;
-
- if (timerActive && lapsedTime >= 250) {
- doSlam();
- }
- lastTimestamp = timestamp;
-
- if (orientationReading == 0) {
- return;
- }
-
- const qreal difference = lastX - x;
-
- if (!detecting
- && orientationReading->orientation() == QOrientationReading::TopUp
- && resting
- && hasBeenResting()) {
- detectedX = x;
- // start of gesture
- detecting = true;
- if (difference > 0)
- wasNegative = false;
- else
- wasNegative = true;
- restingList.clear();
- }
- if (detecting
- && qAbs(difference) > (accelRange * SLAM_DETECTION_FACTOR)) {
- timerActive = true;
- }
- if (detecting &&
- (qAbs(difference) < SLAM_ZERO_FACTOR && qAbs(difference) > 0)) {
- detecting = false;
- }
- lastX = x;
- lastY = y;
- lastZ = z;
-}
-
-bool QSlamSensorGestureRecognizer::hasBeenResting()
-{
- for (int i = 0; i < restingList.count() - 1; i++) {
- if (!restingList.at(i)) {
- return false;
- }
- }
- return true;
-}
-
-void QSlamSensorGestureRecognizer::doSlam()
-{
- if (detecting && (orientationReading->orientation() == QOrientationReading::RightUp
- || orientationReading->orientation() == QOrientationReading::LeftUp)) {
- Q_EMIT slam();
- Q_EMIT detected("slam");
- restingList.clear();
- detecting = false;
- }
- timerActive = false;
- lapsedTime = 0;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h
deleted file mode 100644
index 4217eec3..00000000
--- a/src/plugins/sensorgestures/qtsensors/qslamgesturerecognizer.h
+++ /dev/null
@@ -1,100 +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 QSLAMSENSORGESTURERECOGNIZER_H
-#define QSLAMSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QtSensors/QOrientationSensor>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerReading>
-#include <QtSensors/QOrientationReading>
-QT_BEGIN_NAMESPACE
-
-class QSlamSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QSlamSensorGestureRecognizer(QObject *parent = 0);
- ~QSlamSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void slam();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void doSlam();
-
-private:
-
- QAccelerometer *accel;
- QOrientationReading *orientationReading;
- int accelRange;
- bool active;
-
- bool wasNegative;
- qreal lastX;
- qreal lastY;
- qreal lastZ;
- qreal detectedX;
-
- bool detecting;
-
- qreal accelX;
- qreal roll;
- QList<qreal> restingList;
- bool resting;
-
- bool hasBeenResting();
- quint64 lastTimestamp;
- quint64 lapsedTime;
- bool timerActive;
-};
-
-QT_END_NAMESPACE
-#endif // QSLAMSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp b/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp
deleted file mode 100644
index 7e091479..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.cpp
+++ /dev/null
@@ -1,113 +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 <QtPlugin>
-#include <QStringList>
-#include <QObject>
-
-#include "qtsensorgestureplugin.h"
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-#include "qcoversensorgesturerecognizer.h"
-#include "qtwistsensorgesturerecognizer.h"
-#include "qdoubletapsensorgesturerecognizer.h"
-#include "qhoversensorgesturerecognizer.h"
-#include "qpickupsensorgesturerecognizer.h"
-#include "qshake2recognizer.h"
-#include "qslamgesturerecognizer.h"
-#include "qturnoversensorgesturerecognizer.h"
-#include "qwhipsensorgesturerecognizer.h"
-#include "qfreefallsensorgesturerecognizer.h"
-
-
-QT_BEGIN_NAMESPACE
-
-
-QtSensorGesturePlugin::QtSensorGesturePlugin()
-{
-}
-
-QtSensorGesturePlugin::~QtSensorGesturePlugin()
-{
-}
-
-QStringList QtSensorGesturePlugin::supportedIds() const
-{
- QStringList list;
- list << "QtSensors.cover";
- list << "QtSensors.doubletap";
- list << "QtSensors.hover";
- list << "QtSensors.freefall";
- list << "QtSensors.pickup";
- list << "QtSensors.shake2";
- list << "QtSensors.slam";
- list << "QtSensors.turnover";
- list << "QtSensors.twist";
- list << "QtSensors.whip";
- return list;
-}
-
-QList <QSensorGestureRecognizer *> QtSensorGesturePlugin::createRecognizers()
-{
- QList <QSensorGestureRecognizer *> recognizers;
-
- recognizers.append(new QCoverSensorGestureRecognizer(this));
-
- recognizers.append(new QDoubleTapSensorGestureRecognizer(this));
-
- recognizers.append(new QHoverSensorGestureRecognizer(this));
-
- recognizers.append(new QPickupSensorGestureRecognizer(this));
-
- recognizers.append(new QShake2SensorGestureRecognizer(this));
-
- recognizers.append(new QSlamSensorGestureRecognizer(this));
-
- recognizers.append(new QTurnoverSensorGestureRecognizer(this));
-
- recognizers.append(new QWhipSensorGestureRecognizer(this));
-
- recognizers.append(new QTwistSensorGestureRecognizer(this));
-
- recognizers.append(new QFreefallSensorGestureRecognizer(this));
- return recognizers;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h b/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h
deleted file mode 100644
index 87a93f16..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgestureplugin.h
+++ /dev/null
@@ -1,68 +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 QTSENSORGESTURESPLUGIN_H
-#define QTSENSORGESTURESPLUGIN_H
-
-#include <QObject>
-#include <QStringList>
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-QT_BEGIN_NAMESPACE
-
-class QtSensorGesturePlugin : public QObject, public QSensorGesturePluginInterface
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.QSensorGesturePluginInterface")
- Q_INTERFACES(QSensorGesturePluginInterface)
-
-public:
- explicit QtSensorGesturePlugin();
- ~QtSensorGesturePlugin();
- QList <QSensorGestureRecognizer *> createRecognizers() override;
-
- QStringList gestureSignals() const;
- QStringList supportedIds() const override;
- QString name() const override { return "QtSensorGestures"; }
-
-};
-
-QT_END_NAMESPACE
-#endif // QTSENSORGESTURESPLUGIN_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp b/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp
deleted file mode 100644
index 84d9203f..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.cpp
+++ /dev/null
@@ -1,193 +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 <QDebug>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QtSensorGestureSensorHandler::QtSensorGestureSensorHandler(QObject *parent) :
- QObject(parent),
- accel(0), orientation(0), proximity(0), irProx(0),tapSensor(0)
-{
-}
-
-QtSensorGestureSensorHandler* QtSensorGestureSensorHandler::instance()
-{
- static QtSensorGestureSensorHandler *instance = 0;
- if (!instance) {
- instance = new QtSensorGestureSensorHandler;
- }
- return instance;
-}
-
-void QtSensorGestureSensorHandler::accelChanged()
-{
- Q_EMIT accelReadingChanged(accel->reading());
-}
-
-void QtSensorGestureSensorHandler::orientationChanged()
-{
- Q_EMIT orientationReadingChanged(orientation->reading());
-}
-
-void QtSensorGestureSensorHandler::proximityChanged()
-{
- Q_EMIT proximityReadingChanged(proximity->reading());
-}
-
-void QtSensorGestureSensorHandler::irProximityChanged()
-{
- Q_EMIT irProximityReadingChanged(irProx->reading());
-}
-
-void QtSensorGestureSensorHandler::doubletap()
-{
- Q_EMIT dTabReadingChanged(tapSensor->reading());
-}
-
-bool QtSensorGestureSensorHandler::startSensor(SensorGestureSensors sensor)
-{
- bool ok = true;
- switch (sensor) {
- case Accel:
- //accel
- if (accel == 0x0) {
- accel = new QAccelerometer(this);
- ok = accel->connectToBackend();
- accel->setDataRate(100);
- qoutputrangelist outputranges = accel->outputRanges();
-
- if (outputranges.count() > 0)
- accelRange = (int)(outputranges.at(0).maximum);//39
- else
- accelRange = 39; //this should never happen
- connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
- }
- if (ok && !accel->isActive())
- accel->start();
- break;
- case Orientation:
- //orientation
- if (orientation == 0x0) {
- orientation = new QOrientationSensor(this);
- ok = orientation->connectToBackend();
- orientation->setDataRate(50);
- connect(orientation,SIGNAL(readingChanged()),this,SLOT(orientationChanged()));
- }
- if (ok && !orientation->isActive())
- orientation->start();
- break;
- case Proximity:
- //proximity
- if (proximity == 0x0) {
- proximity = new QProximitySensor(this);
- ok = proximity->connectToBackend();
- connect(proximity,SIGNAL(readingChanged()),this,SLOT(proximityChanged()));
- }
- if (ok && !proximity->isActive())
- proximity->start();
- break;
- case IrProximity:
- //irproximity
- if (irProx == 0x0) {
- irProx = new QIRProximitySensor(this);
- irProx->setDataRate(50);
- ok = irProx->connectToBackend();
- connect(irProx,SIGNAL(readingChanged()),this,SLOT(irProximityChanged()));
- }
- if (ok && !irProx->isActive())
- irProx->start();
- break;
- case Tap:
- //dtap
- if (tapSensor == 0x0) {
- tapSensor = new QTapSensor(this);
- ok = tapSensor->connectToBackend();
- connect(tapSensor,SIGNAL(readingChanged()),this,SLOT(doubletap()));
- }
- if (ok && !tapSensor->isActive())
- tapSensor->start();
- break;
- };
- int val = usedSensorsMap.value(sensor);
- usedSensorsMap.insert(sensor,++val);
-
- return ok;
-}
-
-void QtSensorGestureSensorHandler::stopSensor(SensorGestureSensors sensor)
-{
- // qDebug() << __FUNCTION__ << sensor;
- if (usedSensorsMap.value(sensor) == 0)
- return;
- int val = usedSensorsMap.value(sensor);
- usedSensorsMap.insert(sensor,--val);
- switch (sensor) {
- case Accel:
- //accel
- if (usedSensorsMap.value(sensor) == 0) {
- accel->stop();
- }
- break;
- case Orientation:
- if (usedSensorsMap.value(sensor) == 0) {
- orientation->stop();
- }
- //orientation
- break;
- case Proximity:
- if (usedSensorsMap.value(sensor) == 0) {
- proximity->stop();
- }
- //proximity
- break;
- case IrProximity:
- if (usedSensorsMap.value(sensor) == 0) {
- irProx->stop();
- }
- //irproximity
- break;
- case Tap:
- if (usedSensorsMap.value(sensor) == 0) {
- tapSensor->stop();
- }
- //dtap
- break;
- };
-}
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h b/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h
deleted file mode 100644
index e3f4960b..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensorgesturesensorhandler.h
+++ /dev/null
@@ -1,98 +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 QTSENSORGESTURESENSORHANDLER_H
-#define QTSENSORGESTURESENSORHANDLER_H
-
-#include <QObject>
-
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerFilter>
-#include <QtSensors/QSensor>
-#include <QtSensors/QOrientationSensor>
-#include <QtSensors/QProximitySensor>
-#include <QtSensors/QIRProximitySensor>
-#include <QtSensors/QTapSensor>
-
-class QtSensorGestureSensorHandler : public QObject
-{
- Q_OBJECT
- Q_ENUMS(SensorGestureSensors)
-public:
- explicit QtSensorGestureSensorHandler(QObject *parent = 0);
-
- enum SensorGestureSensors {
- Accel = 0,
- Orientation,
- Proximity,
- IrProximity,
- Tap
- };
- static QtSensorGestureSensorHandler *instance();
- qreal accelRange;
-
-public slots:
- void accelChanged();
- void orientationChanged();
- void proximityChanged();
- void irProximityChanged();
- void doubletap();
-
- bool startSensor(SensorGestureSensors sensor);
- void stopSensor(SensorGestureSensors sensor);
-
-Q_SIGNALS:
- void accelReadingChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void proximityReadingChanged(QProximityReading *reading);
- void irProximityReadingChanged(QIRProximityReading *reading);
- void dTabReadingChanged(QTapReading *reading);
-
-private:
- QAccelerometer *accel;
- QOrientationSensor *orientation;
- QProximitySensor *proximity;
- QIRProximitySensor *irProx;
- QTapSensor *tapSensor;
-
- QMap<SensorGestureSensors, int> usedSensorsMap;
-
-};
-
-#endif // QTSENSORGESTURESENSORHANDLER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtsensors.pro b/src/plugins/sensorgestures/qtsensors/qtsensors.pro
deleted file mode 100644
index 44f18ff5..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtsensors.pro
+++ /dev/null
@@ -1,37 +0,0 @@
-TARGET = qtsensorgestures_plugin
-QT = core sensors
-
-# Input
-HEADERS += qtsensorgestureplugin.h \
- qcoversensorgesturerecognizer.h \
- qdoubletapsensorgesturerecognizer.h \
- qhoversensorgesturerecognizer.h \
- qfreefallsensorgesturerecognizer.h \
- qpickupsensorgesturerecognizer.h \
- qshake2recognizer.h \
- qslamgesturerecognizer.h \
- qturnoversensorgesturerecognizer.h \
- qtwistsensorgesturerecognizer.h \
- qwhipsensorgesturerecognizer.h \
- qtsensorgesturesensorhandler.h
-
-SOURCES += qtsensorgestureplugin.cpp \
- qcoversensorgesturerecognizer.cpp \
- qdoubletapsensorgesturerecognizer.cpp \
- qhoversensorgesturerecognizer.cpp \
- qfreefallsensorgesturerecognizer.cpp \
- qpickupsensorgesturerecognizer.cpp \
- qshake2recognizer.cpp \
- qslamgesturerecognizer.cpp \
- qturnoversensorgesturerecognizer.cpp \
- qtwistsensorgesturerecognizer.cpp \
- qwhipsensorgesturerecognizer.cpp \
- qtsensorgesturesensorhandler.cpp
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = sensorgestures
-PLUGIN_CLASS_NAME = QtSensorGesturePlugin
-PLUGIN_EXTENDS = -
-load(qt_plugin)
diff --git a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp
deleted file mode 100644
index e2d9bea8..00000000
--- a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,139 +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 <QtSensors/QSensor>
-
-#include "qturnoversensorgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-// turnover and put down i.e. facedown
-
-QTurnoverSensorGestureRecognizer::QTurnoverSensorGestureRecognizer(QObject *parent) :
- QSensorGestureRecognizer(parent),
- isClose(0)
- , isFaceDown(0), active(0)
-{
-}
-
-QTurnoverSensorGestureRecognizer::~QTurnoverSensorGestureRecognizer()
-{
-}
-
-void QTurnoverSensorGestureRecognizer::create()
-{
-}
-
-bool QTurnoverSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Proximity)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- active = false;
- }
- } else {
- active = false;
- }
- return active;
-}
-
-bool QTurnoverSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Proximity);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(proximityReadingChanged(QProximityReading*)),
- this,SLOT(proximityChanged(QProximityReading*)));
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- active = false;
-
- return active;
-}
-
-bool QTurnoverSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-QString QTurnoverSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.turnover");
-}
-
-void QTurnoverSensorGestureRecognizer::proximityChanged(QProximityReading *reading)
-{
- isClose = reading->close();
- if (isClose)
- isRecognized();
-}
-
-void QTurnoverSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- switch (reading->orientation()) {
- case QOrientationReading::FaceDown:
- {
- isFaceDown = true;
- isRecognized();
- }
- break;
- default:
- isFaceDown = false;
- break;
- };
-}
-
-void QTurnoverSensorGestureRecognizer::isRecognized()
-{
- if (isClose && isFaceDown) {
- Q_EMIT turnover();
- Q_EMIT detected("turnover");
- }
-}
-QT_END_NAMESPACE
-
diff --git a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h
deleted file mode 100644
index 295cb5f7..00000000
--- a/src/plugins/sensorgestures/qtsensors/qturnoversensorgesturerecognizer.h
+++ /dev/null
@@ -1,80 +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 QTURNOVERSENSORGESTURERECOGNIZER_H
-#define QTURNOVERSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QTurnoverSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QTurnoverSensorGestureRecognizer(QObject *parent = 0);
- ~QTurnoverSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void turnover();
-
-private slots:
- void orientationReadingChanged(QOrientationReading *reading);
- void proximityChanged(QProximityReading *reading);
- void isRecognized();
-
-private:
-
- bool isClose;
- bool isFaceDown;
- bool active;
-
- QList<qreal> zList;
-
-};
-QT_END_NAMESPACE
-#endif // QTURNOVERSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
deleted file mode 100644
index 6a1f1706..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,291 +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 "qtwistsensorgesturerecognizer.h"
-
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-#define TIMER_TIMEOUT 750
-QTwistSensorGestureRecognizer::QTwistSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , orientationReading(0)
- , active(0)
- , detecting(0)
- , checking(0)
- , increaseCount(0)
- , decreaseCount(0)
- , lastAngle(0)
- , detectedAngle(0)
-{
-}
-
-QTwistSensorGestureRecognizer::~QTwistSensorGestureRecognizer()
-{
-}
-
-void QTwistSensorGestureRecognizer::create()
-{
-}
-
-QString QTwistSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.twist");
-}
-
-bool QTwistSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- } else {
-
- active = false;
- }
-
- return active;
-}
-
-bool QTwistSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
-
- reset();
- orientationList.clear();
- active = false;
- return active;
-}
-
-bool QTwistSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QTwistSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
- if (orientationList.count() == 3)
- orientationList.removeFirst();
-
- orientationList.append(reading->orientation());
-
- if (orientationList.count() == 3
- && orientationList.at(2) == QOrientationReading::FaceUp
- && (orientationList.at(1) == QOrientationReading::RightUp
- || orientationList.at(1) == QOrientationReading::LeftUp)) {
- checkTwist();
- }
-
- checkOrientation();
-}
-
-bool QTwistSensorGestureRecognizer::checkOrientation()
-{
- if (orientationReading->orientation() == QOrientationReading::TopDown
- || orientationReading->orientation() == QOrientationReading::FaceDown) {
- reset();
- return false;
- }
- return true;
-}
-
-void QTwistSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- if (orientationReading == 0)
- return;
-
- const qreal x = reading->x();
- const qreal y = reading->y();
- const qreal z = reading->z();
-
- if (!detecting && !checking&& dataList.count() > 21)
- dataList.removeFirst();
-
- qreal angle = qRadiansToDegrees(qAtan(x / qSqrt(y * y + z * z)));
-
- if (qAbs(angle) > 2) {
- if (detecting) {
- if ((angle > 0 && angle < lastAngle)
- || (angle < 0 && angle > lastAngle)) {
- decreaseCount++;
- } else {
- if (decreaseCount > 0)
- decreaseCount--;
- }
- }
-
- if (!detecting && ((angle > 0 && angle > lastAngle)
- || (angle < 0 && angle < lastAngle))
- && ((angle > 0 && lastAngle > 0)
- || (angle < 0 && lastAngle < 0))) {
- increaseCount++;
- } else
- if (!detecting && increaseCount > 3 && qAbs(angle) > 30) {
- decreaseCount = 0;
- detecting = true;
- detectedAngle = qRadiansToDegrees(qAtan(y / qSqrt(x * x + z * z)));
- }
- } else {
- increaseCount = 0;
- increaseCount = 0;
- }
-
- lastAngle = angle;
- if (detecting && decreaseCount >= 4 && qAbs(angle) < 25) {
- checkTwist();
- }
-
- twistAccelData data;
- data.x = x;
- data.y = y;
- data.z = z;
-
- if (qAbs(x) > 1)
- dataList.append(data);
-
- if (qAbs(z) > 15.0) {
- reset();
- }
-
-}
-
-void QTwistSensorGestureRecognizer::checkTwist()
-{
- checking = true;
- int lastx = 0;
- bool ok = false;
- bool spinpoint = false;
-
- if (detectedAngle < 0) {
- reset();
- return;
- }
-
- //// check for orientation changes first
- if (orientationList.count() < 2)
- return;
-
- if (orientationList.count() > 2)
- if (orientationList.at(0) == orientationList.at(2)
- && (orientationList.at(1) == QOrientationReading::LeftUp
- || orientationList.at(1) == QOrientationReading::RightUp)) {
- ok = true;
- if (orientationList.at(1) == QOrientationReading::RightUp)
- detectedAngle = 1;
- else
- detectedAngle = -1;
- }
-
- // now the manual increase/decrease count
- if (!ok) {
- if (increaseCount < 1 || decreaseCount < 3)
- return;
-
- if (increaseCount > 6 && decreaseCount > 4) {
- ok = true;
- if (orientationList.at(1) == QOrientationReading::RightUp)
- detectedAngle = 1;
- else
- detectedAngle = -1;
- }
- }
- // now we're really grasping for anything
- if (!ok)
- for (int i = 0; i < dataList.count(); i++) {
- twistAccelData curData = dataList.at(i);
- if (!spinpoint && qAbs(curData.x) < 1)
- continue;
- if (curData.z >= 0 ) {
- if (!spinpoint && (curData.x > lastx || curData.x < lastx) && curData.x - lastx > 1) {
- ok = true;
- } else if (spinpoint && (curData.x < lastx || curData.x > lastx)&& lastx - curData.x > 1) {
- ok = true;
- } else {
- ok = false;
- }
- } else if (!spinpoint && curData.z < 0) {
- spinpoint = true;
- } else if (spinpoint && curData.z > 9) {
- break;
- }
-
- lastx = curData.x;
- }
- if (ok) {
- if (detectedAngle > 0) {
- Q_EMIT twistLeft();
- Q_EMIT detected("twistLeft");
- } else {
- Q_EMIT twistRight();
- Q_EMIT detected("twistRight");
- }
- }
- reset();
-}
-
-void QTwistSensorGestureRecognizer::reset()
-{
- detecting = false;
- checking = false;
- dataList.clear();
- increaseCount = 0;
- decreaseCount = 0;
- lastAngle = 0;
-}
-
-
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h
deleted file mode 100644
index 3080e2a6..00000000
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.h
+++ /dev/null
@@ -1,96 +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 QWFLICKSENSORGESTURERECOGNIZER_H
-#define QWFLICKSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QOrientationSensor>
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-struct twistAccelData {
- qreal x;
- qreal y;
- qreal z;
-};
-
-class QTwistSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QTwistSensorGestureRecognizer(QObject *parent = 0);
- ~QTwistSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void twistLeft();
- void twistRight();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void checkTwist();
-
-private:
-
- QOrientationReading *orientationReading;
- bool active;
- bool detecting;
- QList <twistAccelData> dataList;
- bool checking;
- void reset();
- bool checkOrientation();
- int increaseCount;
- int decreaseCount;
- qreal lastAngle;
- QList <QOrientationReading::Orientation> orientationList;
- qreal detectedAngle;
-};
-QT_END_NAMESPACE
-#endif // QWFLICKSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
deleted file mode 100644
index 4d9edb25..00000000
--- a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
+++ /dev/null
@@ -1,241 +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 "qwhipsensorgesturerecognizer.h"
-#include "qtsensorgesturesensorhandler.h"
-
-#include <QtCore/qmath.h>
-
-#define TIMER_TIMEOUT 850
-
-QT_BEGIN_NAMESPACE
-
-QWhipSensorGestureRecognizer::QWhipSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent),
- orientationReading(0),
- accelRange(0),
- active(0),
- lastX(0),
- lastY(0),
- lastZ(0),
- detecting(0),
- whipOk(0)
- , lastTimestamp(0)
- , timerActive(0)
- , lapsedTime(0)
-{
-}
-
-QWhipSensorGestureRecognizer::~QWhipSensorGestureRecognizer()
-{
-}
-
-void QWhipSensorGestureRecognizer::create()
-{
-}
-
-QString QWhipSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.whip");
-}
-
-bool QWhipSensorGestureRecognizer::start()
-{
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Accel)) {
- if (QtSensorGestureSensorHandler::instance()->startSensor(QtSensorGestureSensorHandler::Orientation)) {
- accelRange = QtSensorGestureSensorHandler::instance()->accelRange;
- active = true;
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- connect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- } else {
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- active = false;
- }
- } else {
- active = false;
- }
- lastTimestamp = 0;
- timerActive = false;
- lapsedTime = 0;
- return active;
-}
-
-bool QWhipSensorGestureRecognizer::stop()
-{
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Accel);
- QtSensorGestureSensorHandler::instance()->stopSensor(QtSensorGestureSensorHandler::Orientation);
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(orientationReadingChanged(QOrientationReading*)),
- this,SLOT(orientationReadingChanged(QOrientationReading*)));
-
- disconnect(QtSensorGestureSensorHandler::instance(),SIGNAL(accelReadingChanged(QAccelerometerReading*)),
- this,SLOT(accelChanged(QAccelerometerReading*)));
- active = false;
- return active;
-}
-
-bool QWhipSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-void QWhipSensorGestureRecognizer::orientationReadingChanged(QOrientationReading *reading)
-{
- orientationReading = reading;
-}
-
-#define WHIP_FACTOR -11.0
-#define WHIP_WIGGLE_FACTOR 0.35
-
-void QWhipSensorGestureRecognizer::accelChanged(QAccelerometerReading *reading)
-{
- const qreal x = reading->x();
- const qreal y = reading->y();
- qreal z = reading->z();
-
- quint64 timestamp = reading->timestamp();
-
- if (zList.count() > 4)
- zList.removeLast();
-
- qreal averageZ = 0;
- Q_FOREACH (qreal az, zList) {
- averageZ += az;
- }
-// averageZ += z;
- averageZ /= zList.count();
-
- zList.insert(0,z);
-
- if (orientationReading == 0)
- return;
- //// very hacky
- if (orientationReading->orientation() == QOrientationReading::FaceUp) {
- z = z - 9.8;
- }
-
- const qreal diffX = lastX - x;
- const qreal diffY = lastY - y;
-
- if (detecting && whipMap.count() > 5 && whipMap.at(5) == true) {
- checkForWhip();
- }
-
- if (whipMap.count() > 5)
- whipMap.removeLast();
-
- if (negativeList.count() > 5)
- negativeList.removeLast();
-
- if (z < WHIP_FACTOR
- && qAbs(diffX) > -(accelRange * .1285)//-5.0115
- && qAbs(lastX) < 7
- && qAbs(x) < 7) {
- whipMap.insert(0,true);
- if (!detecting && !timerActive) {
- timerActive = true;
- detecting = true;
- }
- } else {
- whipMap.insert(0,false);
- }
-
- // check if shaking
- if ((((x < 0 && lastX > 0) || (x > 0 && lastX < 0))
- && qAbs(diffX) > (accelRange * 0.7)) //27.3
- || (((y < 0 && lastY > 0) || (y > 0 && lastY < 0))
- && qAbs(diffY) > (accelRange * 0.7))) {
- negativeList.insert(0,true);
- } else {
- negativeList.insert(0,false);
- }
-
- lastX = x;
- lastY = y;
- lastZ = z;
-
- if (timerActive && lastTimestamp > 0)
- lapsedTime += (timestamp - lastTimestamp )/1000;
-
- if (timerActive && lapsedTime >= TIMER_TIMEOUT) {
- timeout();
- }
-}
-
-void QWhipSensorGestureRecognizer::timeout()
-{
- detecting = false;
-}
-
-
-void QWhipSensorGestureRecognizer::checkForWhip()
-{
- whipOk = false;
-
- int check = 0;
- Q_FOREACH (qreal az, zList) {
- if (az < -10)
- check++;
- }
- if (check >= 4)
- whipOk = true;
- else
- return;
-
- if (whipOk) {
- bool ok = true;
- for (int i = 0; i < negativeList.count() - 1; i++) {
- if (negativeList.at(i)) {
- ok = false;
- }
- }
- if (ok) {
- Q_EMIT whip();
- Q_EMIT detected("whip");
- }
- detecting = false;
- whipMap.clear();
- timerActive = false;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h
deleted file mode 100644
index 6d674ab5..00000000
--- a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.h
+++ /dev/null
@@ -1,100 +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 QWHIPSENSORGESTURERECOGNIZER_H
-#define QWHIPSENSORGESTURERECOGNIZER_H
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
-#include "qtsensorgesturesensorhandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWhipSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-public:
- explicit QWhipSensorGestureRecognizer(QObject *parent = 0);
- ~QWhipSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
-Q_SIGNALS:
- void whip();
-
-private slots:
- void accelChanged(QAccelerometerReading *reading);
- void orientationReadingChanged(QOrientationReading *reading);
- void timeout();
-
-private:
- QOrientationReading *orientationReading;
- qreal accelRange;
- bool active;
-
- qreal lastX;
- qreal lastY;
- qreal lastZ;
-
- bool detecting;
- bool whipOk;
-
- QList<bool> whipMap;
-
- void checkForWhip();
-
- QList <bool> negativeList;
-
- QList<qreal> zList;
-
- quint64 lastTimestamp;
-
- bool timerActive;
- quint64 lapsedTime;
-
-};
-
-QT_END_NAMESPACE
-#endif // QWHIPSENSORGESTURERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/sensorgestures.pro b/src/plugins/sensorgestures/sensorgestures.pro
deleted file mode 100644
index 162fb8eb..00000000
--- a/src/plugins/sensorgestures/sensorgestures.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += shake qtsensors
diff --git a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp b/src/plugins/sensorgestures/shake/qshakerecognizer.cpp
deleted file mode 100644
index b9ccbdbb..00000000
--- a/src/plugins/sensorgestures/shake/qshakerecognizer.cpp
+++ /dev/null
@@ -1,160 +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 <QDebug>
-#include <QTimer>
-
-#include "qshakerecognizer.h"
-
-QShakeSensorGestureRecognizer::QShakeSensorGestureRecognizer(QObject *parent)
- : QSensorGestureRecognizer(parent)
- , timerTimeout(450)
- , active(0)
- , shaking(0)
- , shakeCount(0)
-{
-}
-
-QShakeSensorGestureRecognizer::~QShakeSensorGestureRecognizer()
-{
-}
-
-void QShakeSensorGestureRecognizer::create()
-{
- accel = new QAccelerometer(this);
- accel->connectToBackend();
- accel->setDataRate(50);
-
- qoutputrangelist outputranges = accel->outputRanges();
-
- if (outputranges.count() > 0)
- accelRange = (int)(outputranges.at(0).maximum *2) / 9.8; //approx range in g's
- else
- accelRange = 4; //this should never happen
-
- connect(accel,SIGNAL(readingChanged()),this,SLOT(accelChanged()));
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),this,SLOT(timeout()));
- timer->setSingleShot(true);
- timer->setInterval(timerTimeout);
-}
-
-bool QShakeSensorGestureRecognizer::start()
-{
- active = accel->start();
- return active;
-}
-
-bool QShakeSensorGestureRecognizer::stop()
-{
- accel->stop();
- active = accel->isActive();
- return !active;
-}
-
-bool QShakeSensorGestureRecognizer::isActive()
-{
- return active;
-}
-
-QString QShakeSensorGestureRecognizer::id() const
-{
- return QString("QtSensors.shake");
-}
-
-#define NUMBER_SHAKES 3
-#define THRESHOLD 25
-
-void QShakeSensorGestureRecognizer::accelChanged()
-{
- qreal x = accel->reading()->x();
- qreal y = accel->reading()->y();
- qreal z = accel->reading()->z();
-
- currentData.x = x;
- currentData.y = y;
- currentData.z = z;
-
- if (qAbs(prevData.x - currentData.x) < 1
- && qAbs(prevData.y - currentData.y) < 1
- && qAbs(prevData.z - currentData.z) < 1) {
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
- return;
- }
-
- bool wasShake = checkForShake(prevData, currentData, THRESHOLD);
- if (!shaking && wasShake &&
- shakeCount >= NUMBER_SHAKES) {
- shaking = true;
- shakeCount = 0;
- Q_EMIT shake();
- Q_EMIT detected("shake");
-
- } else if (wasShake) {
-
- shakeCount++;
- if (shakeCount > NUMBER_SHAKES) {
- timer->start();
- }
- }
-
- prevData.x = currentData.x;
- prevData.y = currentData.y;
- prevData.z = currentData.z;
-}
-
-void QShakeSensorGestureRecognizer::timeout()
-{
- shakeCount = 0;
- shaking = false;
-}
-
-bool QShakeSensorGestureRecognizer::checkForShake(AccelData prevSensorData, AccelData currentSensorData, qreal threshold)
-{
- double deltaX = qAbs(prevSensorData.x - currentSensorData.x);
- double deltaY = qAbs(prevSensorData.y - currentSensorData.y);
- double deltaZ = qAbs(prevSensorData.z - currentSensorData.z);
-
- return (deltaX > threshold
- || deltaY > threshold
- || deltaZ > threshold);
-}
-
diff --git a/src/plugins/sensorgestures/shake/qshakerecognizer.h b/src/plugins/sensorgestures/shake/qshakerecognizer.h
deleted file mode 100644
index 21c85664..00000000
--- a/src/plugins/sensorgestures/shake/qshakerecognizer.h
+++ /dev/null
@@ -1,98 +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 QSHAKERECOGNIZER_H
-#define QSHAKERECOGNIZER_H
-
-
-#include <QtSensors/QSensor>
-#include <QtSensors/QAccelerometer>
-#include <QtSensors/QAccelerometerFilter>
-#include <QDebug>
-#include <QTimer>
-
-#include <QtSensors/qsensorgesturerecognizer.h>
-
- struct AccelData {
- qreal x;
- qreal y;
- qreal z;
-};
-
-class QShakeSensorGestureRecognizer : public QSensorGestureRecognizer
-{
- Q_OBJECT
-
-public:
-
- QShakeSensorGestureRecognizer(QObject *parent = 0);
- ~QShakeSensorGestureRecognizer();
-
- void create() override;
-
- QString id() const override;
- bool start() override;
- bool stop() override;
- bool isActive() override;
-
- QTimer *timer;
- int timerTimeout;
-
-Q_SIGNALS:
- void shake();
-
-private slots:
- void accelChanged();
- void timeout();
-private:
- QAccelerometer *accel;
- bool active;
- int accelRange;
-
- AccelData prevData;
- AccelData currentData;
-
- bool checkForShake(AccelData prevSensorData, AccelData currentSensorData, qreal threshold);
- bool shaking;
- int shakeCount;
- int threshold;
-
-};
-
-#endif // QSHAKERECOGNIZER_H
diff --git a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp b/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp
deleted file mode 100644
index 243b2dbf..00000000
--- a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.cpp
+++ /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$
-**
-****************************************************************************/
-
-#include <QtPlugin>
-#include <QStringList>
-#include <QObject>
-
-#include "qshakesensorgestureplugin.h"
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-#include "qshakerecognizer.h"
-
-
-QShakeSensorGesturePlugin::QShakeSensorGesturePlugin()
-{
-}
-
-QShakeSensorGesturePlugin::~QShakeSensorGesturePlugin()
-{
-}
-
-QStringList QShakeSensorGesturePlugin::supportedIds() const
-{
- QStringList list;
- list << "QtSensors.shake";
- return list;
-}
-
-QList <QSensorGestureRecognizer *> QShakeSensorGesturePlugin::createRecognizers()
-{
- QList <QSensorGestureRecognizer *> recognizers;
-
- QSensorGestureRecognizer *sRec = new QShakeSensorGestureRecognizer(this);
- recognizers.append(sRec);
-
- return recognizers;
-}
diff --git a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h b/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h
deleted file mode 100644
index 96814eb8..00000000
--- a/src/plugins/sensorgestures/shake/qshakesensorgestureplugin.h
+++ /dev/null
@@ -1,65 +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 QSHAKESENSORGESTUREPLUGIN_H
-#define QSHAKESENSORGESTUREPLUGIN_H
-
-#include <QObject>
-#include <QStringList>
-
-#include <QtSensors/qsensorgestureplugininterface.h>
-
-class QShakeSensorGesturePlugin : public QObject, public QSensorGesturePluginInterface
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.QSensorGesturePluginInterface")
- Q_INTERFACES(QSensorGesturePluginInterface)
-
-public:
- explicit QShakeSensorGesturePlugin();
- ~QShakeSensorGesturePlugin();
-
- QList <QSensorGestureRecognizer *> createRecognizers() override;
-
- QStringList gestureSignals() const;
- QStringList supportedIds() const override;
- QString name() const override { return "ShakeGestures"; }
-};
-
-#endif // QSHAKESENSORGESTUREPLUGIN_H
diff --git a/src/plugins/sensorgestures/shake/shake.pro b/src/plugins/sensorgestures/shake/shake.pro
deleted file mode 100644
index efa2a0cb..00000000
--- a/src/plugins/sensorgestures/shake/shake.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qtsensorgestures_shakeplugin
-QT = core sensors
-
-# Input
-HEADERS += qshakesensorgestureplugin.h \
- qshakerecognizer.h
-SOURCES += qshakesensorgestureplugin.cpp \
- qshakerecognizer.cpp
-
-OTHER_FILES += \
- plugin.json
-
-PLUGIN_TYPE = sensorgestures
-PLUGIN_CLASS_NAME = QShakeSensorGesturePlugin
-PLUGIN_EXTENDS = -
-load(qt_plugin)
diff --git a/src/plugins/sensors/CMakeLists.txt b/src/plugins/sensors/CMakeLists.txt
new file mode 100644
index 00000000..e7527d8f
--- /dev/null
+++ b/src/plugins/sensors/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+# all get generic sensor
+add_subdirectory(generic)
+
+if(ANDROID AND NOT SENSORS_PLUGINS OR "sensorfw" IN_LIST SENSORS_PLUGINS)
+ add_subdirectory(android)
+endif()
+
+# Currently disabled, see src/sensors/configure.cmake
+#if (QT_FEATURE_sensorfw AND NOT SENSORS_PLUGINS OR "sensorfw" IN_LIST SENSORS_PLUGINS)
+# add_subdirectory(sensorfw)
+#endif()
+
+if (QT_FEATURE_winrt_sensors AND NOT SENSORS_PLUGINS OR "winrt" IN_LIST SENSORS_PLUGINS)
+ add_subdirectory(winrt)
+endif()
+
+if (IOS AND NOT SENSORS_PLUGINS OR "ios" IN_LIST SENSORS_PLUGINS)
+ add_subdirectory(ios)
+endif()
+
+if(LINUX AND TARGET Qt::DBus AND NOT SENSORS_PLUGINS OR "iio-sensor-proxy" IN_LIST SENSORS_PLUGINS)
+ add_subdirectory(iio-sensor-proxy)
+endif()
+
+if("dummy" IN_LIST SENSORS_PLUGINS)
+ add_subdirectory(dummy)
+endif()
diff --git a/src/plugins/sensors/android/CMakeLists.txt b/src/plugins/sensors/android/CMakeLists.txt
new file mode 100644
index 00000000..9a77a9a5
--- /dev/null
+++ b/src/plugins/sensors/android/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## QCounterGesturePlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(AndroidSensorPlugin
+ OUTPUT_NAME qtsensors_android
+ PLUGIN_TYPE sensors
+ SOURCES
+ androidaccelerometer.cpp androidaccelerometer.h
+ androidcompass.cpp androidcompass.h
+ androidgyroscope.cpp androidgyroscope.h
+ androidlight.cpp androidlight.h
+ androidmagnetometer.cpp androidmagnetometer.h
+ androidpressure.cpp androidpressure.h
+ androidproximity.cpp androidproximity.h
+ androidrotation.cpp androidrotation.h
+ androidtemperature.cpp androidtemperature.h
+ main.cpp
+ sensoreventqueue.h
+ sensormanager.cpp sensormanager.h
+ DEFINES
+ # STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp
+ # Yes, the plugin imports itself statically
+ QT_STATICPLUGIN
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Sensors
+ android
+)
+
+#### Keys ignored in scope 1:.:.:android.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/sensors/android/android.pro b/src/plugins/sensors/android/android.pro
deleted file mode 100644
index 15e26ee9..00000000
--- a/src/plugins/sensors/android/android.pro
+++ /dev/null
@@ -1,41 +0,0 @@
-TARGET = qtsensors_android
-
-QT = sensors core-private
-
-# STATICPLUGIN needed because there's a Q_IMPORT_PLUGIN in main.cpp
-# Yes, the plugin imports itself statically
-DEFINES += QT_STATICPLUGIN
-
-HEADERS = \
- androidaccelerometer.h \
- androidcompass.h \
- androidgyroscope.h \
- androidmagnetometer.h \
- androidpressure.h \
- androidproximity.h \
- androidrotation.h \
- androidtemperature.h \
- androidlight.h \
- sensoreventqueue.h \
- sensormanager.h
-
-SOURCES = \
- main.cpp \
- androidaccelerometer.cpp \
- androidcompass.cpp \
- androidgyroscope.cpp \
- androidmagnetometer.cpp \
- androidpressure.cpp \
- androidproximity.cpp \
- androidrotation.cpp \
- androidtemperature.cpp \
- androidlight.cpp \
- sensormanager.cpp
-
-OTHER_FILES = plugin.json
-
-LIBS += -landroid
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = QCounterGesturePlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/android/androidaccelerometer.cpp b/src/plugins/sensors/android/androidaccelerometer.cpp
index f38e0047..1e6004ed 100644
--- a/src/plugins/sensors/android/androidaccelerometer.cpp
+++ b/src/plugins/sensors/android/androidaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidaccelerometer.h"
#include <QDebug>
diff --git a/src/plugins/sensors/android/androidaccelerometer.h b/src/plugins/sensors/android/androidaccelerometer.h
index 04362451..32fa6410 100644
--- a/src/plugins/sensors/android/androidaccelerometer.h
+++ b/src/plugins/sensors/android/androidaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDACCELEROMETER_H
#define ANDROIDACCELEROMETER_H
diff --git a/src/plugins/sensors/android/androidcompass.cpp b/src/plugins/sensors/android/androidcompass.cpp
index 653c5e99..d6f4f0f7 100644
--- a/src/plugins/sensors/android/androidcompass.cpp
+++ b/src/plugins/sensors/android/androidcompass.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
* Copyright (C) 2008 The Android Open Source Project
diff --git a/src/plugins/sensors/android/androidcompass.h b/src/plugins/sensors/android/androidcompass.h
index 1d20de72..592d641c 100644
--- a/src/plugins/sensors/android/androidcompass.h
+++ b/src/plugins/sensors/android/androidcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDCOMPASS_H
#define ANDROIDCOMPASS_H
diff --git a/src/plugins/sensors/android/androidgyroscope.cpp b/src/plugins/sensors/android/androidgyroscope.cpp
index 2a38b5a0..acc4798a 100644
--- a/src/plugins/sensors/android/androidgyroscope.cpp
+++ b/src/plugins/sensors/android/androidgyroscope.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidgyroscope.h"
#include <QtCore/qmath.h>
diff --git a/src/plugins/sensors/android/androidgyroscope.h b/src/plugins/sensors/android/androidgyroscope.h
index 7d1ecec0..2dd3c8cc 100644
--- a/src/plugins/sensors/android/androidgyroscope.h
+++ b/src/plugins/sensors/android/androidgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDGYROSCOPE_H
#define ANDROIDGYROSCOPE_H
diff --git a/src/plugins/sensors/android/androidlight.cpp b/src/plugins/sensors/android/androidlight.cpp
index 724ed970..42c8f0b7 100644
--- a/src/plugins/sensors/android/androidlight.cpp
+++ b/src/plugins/sensors/android/androidlight.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidlight.h"
diff --git a/src/plugins/sensors/android/androidlight.h b/src/plugins/sensors/android/androidlight.h
index 74c963fb..59c67981 100644
--- a/src/plugins/sensors/android/androidlight.h
+++ b/src/plugins/sensors/android/androidlight.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDLIGHT_H
#define ANDROIDLIGHT_H
diff --git a/src/plugins/sensors/android/androidmagnetometer.cpp b/src/plugins/sensors/android/androidmagnetometer.cpp
index ec663c0b..54d2225e 100644
--- a/src/plugins/sensors/android/androidmagnetometer.cpp
+++ b/src/plugins/sensors/android/androidmagnetometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidmagnetometer.h"
diff --git a/src/plugins/sensors/android/androidmagnetometer.h b/src/plugins/sensors/android/androidmagnetometer.h
index fb1f0ee7..e4e0fcbd 100644
--- a/src/plugins/sensors/android/androidmagnetometer.h
+++ b/src/plugins/sensors/android/androidmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDMAGNETOMETER_H
#define ANDROIDMAGNETOMETER_H
diff --git a/src/plugins/sensors/android/androidpressure.cpp b/src/plugins/sensors/android/androidpressure.cpp
index 46acffd6..50dd86a0 100644
--- a/src/plugins/sensors/android/androidpressure.cpp
+++ b/src/plugins/sensors/android/androidpressure.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidpressure.h"
diff --git a/src/plugins/sensors/android/androidpressure.h b/src/plugins/sensors/android/androidpressure.h
index ec682e59..7121d73c 100644
--- a/src/plugins/sensors/android/androidpressure.h
+++ b/src/plugins/sensors/android/androidpressure.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDPRESSURE_H
#define ANDROIDPRESSURE_H
diff --git a/src/plugins/sensors/android/androidproximity.cpp b/src/plugins/sensors/android/androidproximity.cpp
index 000399b0..2c134ba0 100644
--- a/src/plugins/sensors/android/androidproximity.cpp
+++ b/src/plugins/sensors/android/androidproximity.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidproximity.h"
diff --git a/src/plugins/sensors/android/androidproximity.h b/src/plugins/sensors/android/androidproximity.h
index 22169d6f..215292e8 100644
--- a/src/plugins/sensors/android/androidproximity.h
+++ b/src/plugins/sensors/android/androidproximity.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDPROXIMITY_H
#define ANDROIDPROXIMITY_H
diff --git a/src/plugins/sensors/android/androidrotation.cpp b/src/plugins/sensors/android/androidrotation.cpp
index c1d141a0..43586a0f 100644
--- a/src/plugins/sensors/android/androidrotation.cpp
+++ b/src/plugins/sensors/android/androidrotation.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidrotation.h"
@@ -48,12 +12,41 @@ AndroidRotation::AndroidRotation(int type, QSensor *sensor, QObject *parent)
void AndroidRotation::dataReceived(const ASensorEvent &event)
{
- // ### Check me, at first look it seems wrong,
- // here https://developer.android.com/reference/android/hardware/SensorEvent.html#sensor.type_rotation_vector:
- // are the Android values
- qreal rz = -qRadiansToDegrees(qreal(event.data[0])); // event.data[0] corresponds to x
- qreal rx = -qRadiansToDegrees(qreal(event.data[1])); // event.data[1] corresponds to y
- qreal ry = qRadiansToDegrees(qreal(event.data[2])); // event.data[2] corresponds to z
+ // From android documentation, the rotation sensor values are:
+ // values[0]: x*sin(θ/2)
+ // values[1]: y*sin(θ/2)
+ // values[2]: z*sin(θ/2)
+ // values[3]: cos(θ/2)
+
+ // The mathematics below is adapted from
+ // https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/hardware/SensorManager.java#1644
+ // and
+ // https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/hardware/SensorManager.java#1469
+ // (getRotationMatrixFromVector() followed by getOrientation())
+ qreal angles[3];
+ qreal q1 = qreal(event.data[0]);
+ qreal q2 = qreal(event.data[1]);
+ qreal q3 = qreal(event.data[2]);
+ qreal q0 = qreal(event.data[3]);
+
+ qreal sq_q1 = 2 * q1 * q1;
+ qreal sq_q2 = 2 * q2 * q2;
+ qreal sq_q3 = 2 * q3 * q3;
+ qreal q1_q2 = 2 * q1 * q2;
+ qreal q3_q0 = 2 * q3 * q0;
+ qreal q1_q3 = 2 * q1 * q3;
+ qreal q2_q0 = 2 * q2 * q0;
+ qreal q2_q3 = 2 * q2 * q3;
+ qreal q1_q0 = 2 * q1 * q0;
+
+ angles[0] = std::atan2((q1_q2 - q3_q0), (1 - sq_q1 - sq_q3));
+ angles[1] = std::asin(-(q2_q3 + q1_q0));
+ angles[2] = std::atan2(-(q1_q3 - q2_q0), (1 - sq_q1 - sq_q2));
+
+ qreal rz = -qRadiansToDegrees(angles[0]);
+ qreal rx = -qRadiansToDegrees(angles[1]);
+ qreal ry = qRadiansToDegrees(angles[2]);
+
if (sensor()->skipDuplicates() && qFuzzyCompare(m_reader.x(), rx) &&
qFuzzyCompare(m_reader.y(), ry) &&
qFuzzyCompare(m_reader.z(), rz)) {
diff --git a/src/plugins/sensors/android/androidrotation.h b/src/plugins/sensors/android/androidrotation.h
index 9761b249..84860c11 100644
--- a/src/plugins/sensors/android/androidrotation.h
+++ b/src/plugins/sensors/android/androidrotation.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDROTATION_H
#define ANDROIDROTATION_H
diff --git a/src/plugins/sensors/android/androidtemperature.cpp b/src/plugins/sensors/android/androidtemperature.cpp
index 5f85750a..f4c6cbe2 100644
--- a/src/plugins/sensors/android/androidtemperature.cpp
+++ b/src/plugins/sensors/android/androidtemperature.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "androidtemperature.h"
diff --git a/src/plugins/sensors/android/androidtemperature.h b/src/plugins/sensors/android/androidtemperature.h
index ba626051..654a5faa 100644
--- a/src/plugins/sensors/android/androidtemperature.h
+++ b/src/plugins/sensors/android/androidtemperature.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef ANDROIDTEMPERATURE_H
#define ANDROIDTEMPERATURE_H
diff --git a/src/plugins/sensors/android/main.cpp b/src/plugins/sensors/android/main.cpp
index 85853cd2..8c2855cd 100644
--- a/src/plugins/sensors/android/main.cpp
+++ b/src/plugins/sensors/android/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qplugin.h>
#include <qsensorplugin.h>
@@ -77,7 +41,7 @@ public:
switch (sensor) {
case ASENSOR_TYPE_ACCELEROMETER:
m_accelerationModes |= AndroidAccelerometer::Accelerometer;
- QSensorManager::registerBackend(QAccelerometer::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, QByteArray::number(sensor), this);
accelerometer = true;
break;
case ASENSOR_TYPE_GRAVITY:
@@ -87,26 +51,26 @@ public:
m_accelerationModes |= AndroidAccelerometer::LinearAcceleration;
break;
case ASENSOR_TYPE_AMBIENT_TEMPERATURE:
- QSensorManager::registerBackend(QAmbientTemperatureSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QAmbientTemperatureSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_GYROSCOPE:
- QSensorManager::registerBackend(QGyroscope::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QGyroscope::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_LIGHT:
- QSensorManager::registerBackend(QLightSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QLightSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_MAGNETIC_FIELD:
- QSensorManager::registerBackend(QMagnetometer::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QMagnetometer::sensorType, QByteArray::number(sensor), this);
magnetometer = true;
break;
case ASENSOR_TYPE_PRESSURE:
- QSensorManager::registerBackend(QPressureSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QPressureSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_PROXIMITY:
- QSensorManager::registerBackend(QProximitySensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QProximitySensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_ROTATION_VECTOR:
- QSensorManager::registerBackend(QRotationSensor::type, QByteArray::number(sensor), this);
+ QSensorManager::registerBackend(QRotationSensor::sensorType, QByteArray::number(sensor), this);
break;
case ASENSOR_TYPE_RELATIVE_HUMIDITY:
@@ -128,7 +92,7 @@ public:
}
}
if (accelerometer && magnetometer)
- QSensorManager::registerBackend(QCompass::type, AndroidCompassId, this);
+ QSensorManager::registerBackend(QCompass::sensorType, AndroidCompassId, this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/plugins/sensors/android/sensoreventqueue.h b/src/plugins/sensors/android/sensoreventqueue.h
index 77bf05c6..b18401e9 100644
--- a/src/plugins/sensors/android/sensoreventqueue.h
+++ b/src/plugins/sensors/android/sensoreventqueue.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSOREVENTQUEUE_H
#define SENSOREVENTQUEUE_H
@@ -125,8 +89,9 @@ public:
void start() override
{
ASensorEventQueue_enableSensor(m_sensorEventQueue, m_sensor);
+ // The QSensor datarate is in Hz (frequency), whereas the setEventRate expects microseconds
if (sensor()->dataRate() > 0)
- ASensorEventQueue_setEventRate(m_sensorEventQueue, m_sensor, std::max(ASensor_getMinDelay(m_sensor), sensor()->dataRate()));
+ ASensorEventQueue_setEventRate(m_sensorEventQueue, m_sensor, std::max(ASensor_getMinDelay(m_sensor), 1000000/sensor()->dataRate()));
m_started = true;
}
void stop() override
diff --git a/src/plugins/sensors/android/sensormanager.cpp b/src/plugins/sensors/android/sensormanager.cpp
index 542e54c9..755b6109 100644
--- a/src/plugins/sensors/android/sensormanager.cpp
+++ b/src/plugins/sensors/android/sensormanager.cpp
@@ -1,48 +1,23 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensormanager.h"
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qjnitypes.h>
+
#include <dlfcn.h>
+Q_DECLARE_JNI_CLASS(AndroidContext, "android/content/Context")
+Q_DECLARE_JNI_CLASS(Sensor, "android/hardware/Sensor")
+
SensorManager::SensorManager()
{
- auto sensorService = QJNIObjectPrivate::getStaticObjectField("android.content.Context", "SENSOR_SERVICE", "Ljava/lang/String;");
- m_sensorManager = QJNIObjectPrivate{QtAndroidPrivate::context()}.callObjectMethod("getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;", sensorService.object());
+ auto sensorService =
+ QJniObject::getStaticField<QtJniTypes::AndroidContext, jstring>("SENSOR_SERVICE");
+
+ QJniObject context = QNativeInterface::QAndroidApplication::context();
+ m_sensorManager = context.callMethod<jobject>("getSystemService",
+ sensorService.object<jstring>());
setObjectName("QtSensorsLooperThread");
start();
m_waitForStart.acquire();
@@ -50,13 +25,14 @@ SensorManager::SensorManager()
SensorManager::~SensorManager()
{
- m_quit.store(1);
+ m_quit.storeRelaxed(1);
wait();
}
-QJNIObjectPrivate SensorManager::javaSensor(const ASensor *sensor) const
+QJniObject SensorManager::javaSensor(const ASensor *sensor) const
{
- return m_sensorManager.callObjectMethod("getDefaultSensor", "(I)Landroid/hardware/Sensor;", ASensor_getType(sensor));
+ return m_sensorManager.callMethod<QtJniTypes::Sensor>("getDefaultSensor",
+ ASensor_getType(sensor));
}
QSharedPointer<SensorManager> &SensorManager::instance()
@@ -72,19 +48,18 @@ ALooper *SensorManager::looper() const
static inline ASensorManager* androidManager()
{
+ QJniObject context = QNativeInterface::QAndroidApplication::context();
+ auto packageName = context.callMethod<jstring>("getPackageName").toString().toUtf8();
+
#if __ANDROID_API__ >= 26
- return ASensorManager_getInstanceForPackage(QJNIObjectPrivate{QtAndroidPrivate::context()}
- .callObjectMethod("getPackageName", "()Ljava/lang/String;")
- .toString().toUtf8().constData());
+ return ASensorManager_getInstanceForPackage(packageName.constData());
#else
- if (QtAndroidPrivate::androidSdkVersion() >= 26) {
+ if (QNativeInterface::QAndroidApplication::sdkVersion() >= 26) {
using GetInstanceForPackage = ASensorManager *(*)(const char *);
auto handler = dlopen("libandroid.so", RTLD_NOW);
auto function = GetInstanceForPackage(dlsym(handler, "ASensorManager_getInstanceForPackage"));
if (function) {
- auto res = function(QJNIObjectPrivate{QtAndroidPrivate::context()}
- .callObjectMethod("getPackageName", "()Ljava/lang/String;")
- .toString().toUtf8().constData());
+ auto res = function(packageName.constData());
dlclose(handler);
return res;
}
@@ -101,7 +76,8 @@ ASensorManager *SensorManager::manager() const
QString SensorManager::description(const ASensor *sensor) const
{
- return QString::fromUtf8(ASensor_getName(sensor)) + " " + ASensor_getVendor(sensor) + " v" + QString::number(javaSensor(sensor).callMethod<jint>("getVersion"));
+ return QString::fromUtf8(ASensor_getName(sensor)) + " " + ASensor_getVendor(sensor)
+ + " v" + QString::number(javaSensor(sensor).callMethod<jint>("getVersion"));
}
double SensorManager::getMaximumRange(const ASensor *sensor) const
@@ -116,5 +92,5 @@ void SensorManager::run()
do {
if (ALooper_pollAll(5 /*ms*/, nullptr, nullptr, nullptr) == ALOOPER_POLL_TIMEOUT)
QThread::yieldCurrentThread();
- } while (!m_quit.load());
+ } while (!m_quit.loadRelaxed());
}
diff --git a/src/plugins/sensors/android/sensormanager.h b/src/plugins/sensors/android/sensormanager.h
index dc7ffe1f..1d3c274b 100644
--- a/src/plugins/sensors/android/sensormanager.h
+++ b/src/plugins/sensors/android/sensormanager.h
@@ -1,52 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORMANAGER_H
#define SENSORMANAGER_H
-#include <QThread>
-#include <QSemaphore>
-#include <QMutex>
-#include <QWaitCondition>
-
-#include <private/qjni_p.h>
-#include <private/qjnihelpers_p.h>
+#include <QtCore/qthread.h>
+#include <QtCore/qsemaphore.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qwaitcondition.h>
+#include <QtCore/qjniobject.h>
#include <android/sensor.h>
@@ -58,7 +21,7 @@ public:
ALooper *looper() const;
ASensorManager *manager() const;
- QJNIObjectPrivate javaSensor(const ASensor *sensor) const;
+ QJniObject javaSensor(const ASensor *sensor) const;
QString description(const ASensor *sensor) const;
double getMaximumRange(const ASensor *sensor) const;
@@ -71,7 +34,7 @@ private:
QAtomicInt m_quit{0};
ALooper *m_looper = nullptr;
QSemaphore m_waitForStart;
- QJNIObjectPrivate m_sensorManager;
+ QJniObject m_sensorManager;
};
#endif // SENSORMANAGER_H
diff --git a/src/plugins/sensors/dummy/CMakeLists.txt b/src/plugins/sensors/dummy/CMakeLists.txt
new file mode 100644
index 00000000..19f93329
--- /dev/null
+++ b/src/plugins/sensors/dummy/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## dummySensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(dummySensorPlugin
+ OUTPUT_NAME qtsensors_dummy
+ PLUGIN_TYPE sensors
+ SOURCES
+ dummyaccelerometer.cpp dummyaccelerometer.h
+ dummycommon.cpp dummycommon.h
+ dummylightsensor.cpp dummylightsensor.h
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:dummy.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(dummySensorPlugin CONDITION UNIX AND NOT ANDROID AND NOT APPLE AND NOT OPENBSD AND NOT QNX
+ LIBRARIES
+ rt
+)
diff --git a/src/plugins/sensors/dummy/dummy.pro b/src/plugins/sensors/dummy/dummy.pro
deleted file mode 100644
index 6eab4912..00000000
--- a/src/plugins/sensors/dummy/dummy.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET = qtsensors_dummy
-QT = sensors core
-
-HEADERS += dummycommon.h\
- dummyaccelerometer.h\
- dummylightsensor.h
-
-SOURCES += dummycommon.cpp\
- dummyaccelerometer.cpp\
- dummylightsensor.cpp\
- main.cpp
-
-OTHER_FILES = plugin.json
-
-unix:!darwin:!qnx:!android:!openbsd: LIBS += -lrt
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = dummySensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/dummy/dummyaccelerometer.cpp b/src/plugins/sensors/dummy/dummyaccelerometer.cpp
index f0246915..c46683ef 100644
--- a/src/plugins/sensors/dummy/dummyaccelerometer.cpp
+++ b/src/plugins/sensors/dummy/dummyaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummyaccelerometer.h"
#include <QDebug>
diff --git a/src/plugins/sensors/dummy/dummyaccelerometer.h b/src/plugins/sensors/dummy/dummyaccelerometer.h
index 6c890f64..3d1a99cc 100644
--- a/src/plugins/sensors/dummy/dummyaccelerometer.h
+++ b/src/plugins/sensors/dummy/dummyaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DUMMYACCELEROMETER_H
#define DUMMYACCELEROMETER_H
diff --git a/src/plugins/sensors/dummy/dummycommon.cpp b/src/plugins/sensors/dummy/dummycommon.cpp
index 4a19b13f..f5b63146 100644
--- a/src/plugins/sensors/dummy/dummycommon.cpp
+++ b/src/plugins/sensors/dummy/dummycommon.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummycommon.h"
@@ -54,7 +18,7 @@ void dummycommon::start()
int dataRate = sensor()->dataRate();
if (dataRate == 0) {
- if (sensor()->availableDataRates().count())
+ if (sensor()->availableDataRates().size())
// Use the first available rate when -1 is chosen
dataRate = sensor()->availableDataRates().first().first;
else
diff --git a/src/plugins/sensors/dummy/dummycommon.h b/src/plugins/sensors/dummy/dummycommon.h
index 5e775b64..8f5f9703 100644
--- a/src/plugins/sensors/dummy/dummycommon.h
+++ b/src/plugins/sensors/dummy/dummycommon.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DUMMYCOMMON_H
#define DUMMYCOMMON_H
diff --git a/src/plugins/sensors/dummy/dummylightsensor.cpp b/src/plugins/sensors/dummy/dummylightsensor.cpp
index 8f2a9b8e..efdf360b 100644
--- a/src/plugins/sensors/dummy/dummylightsensor.cpp
+++ b/src/plugins/sensors/dummy/dummylightsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummylightsensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/dummy/dummylightsensor.h b/src/plugins/sensors/dummy/dummylightsensor.h
index 3bcaf413..5a4e84ec 100644
--- a/src/plugins/sensors/dummy/dummylightsensor.h
+++ b/src/plugins/sensors/dummy/dummylightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef DUMMYLIGHTSENSOR_H
#define DUMMYLIGHTSENSOR_H
diff --git a/src/plugins/sensors/dummy/main.cpp b/src/plugins/sensors/dummy/main.cpp
index 13dd732e..79755753 100644
--- a/src/plugins/sensors/dummy/main.cpp
+++ b/src/plugins/sensors/dummy/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "dummyaccelerometer.h"
#include "dummylightsensor.h"
@@ -53,8 +17,8 @@ class dummySensorPlugin : public QObject, public QSensorPluginInterface, public
public:
void registerSensors() override
{
- QSensorManager::registerBackend(QAccelerometer::type, dummyaccelerometer::id, this);
- QSensorManager::registerBackend(QAmbientLightSensor::type, dummylightsensor::id, this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, dummyaccelerometer::id, this);
+ QSensorManager::registerBackend(QAmbientLightSensor::sensorType, dummylightsensor::id, this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/plugins/sensors/generic/CMakeLists.txt b/src/plugins/sensors/generic/CMakeLists.txt
new file mode 100644
index 00000000..449401ab
--- /dev/null
+++ b/src/plugins/sensors/generic/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## genericSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(genericSensorPlugin
+ OUTPUT_NAME qtsensors_generic
+ PLUGIN_TYPE sensors
+ SOURCES
+ genericalssensor.cpp genericalssensor.h
+ genericorientationsensor.cpp genericorientationsensor.h
+ generictiltsensor.cpp generictiltsensor.h
+ main.cpp
+ DEFINES
+ QTSENSORS_GENERICALSSENSOR
+ QTSENSORS_GENERICORIENTATIONSENSOR
+ QTSENSORS_GENERICTILTSENSOR
+ LIBRARIES
+ Qt::Core
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:generic.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(genericSensorPlugin CONDITION NOT ANDROID
+ SOURCES
+ genericrotationsensor.cpp genericrotationsensor.h
+ DEFINES
+ QTSENSORS_GENERICROTATIONSENSOR
+)
diff --git a/src/plugins/sensors/generic/generic.pro b/src/plugins/sensors/generic/generic.pro
deleted file mode 100644
index cf87ccf3..00000000
--- a/src/plugins/sensors/generic/generic.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-TARGET = qtsensors_generic
-QT = core sensors
-
-HEADERS += generictiltsensor.h
-
-SOURCES += main.cpp\
- generictiltsensor.cpp
-DEFINES += QTSENSORS_GENERICTILTSENSOR
-
-HEADERS += genericorientationsensor.h\
- genericalssensor.h
-
-SOURCES += genericorientationsensor.cpp\
- genericalssensor.cpp
-DEFINES += QTSENSORS_GENERICORIENTATIONSENSOR QTSENSORS_GENERICALSSENSOR
-
-!android {
- HEADERS += genericrotationsensor.h
-
- SOURCES += genericrotationsensor.cpp
-
- DEFINES += QTSENSORS_GENERICROTATIONSENSOR
-}
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = genericSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/generic/genericalssensor.cpp b/src/plugins/sensors/generic/genericalssensor.cpp
index cd20e7e8..af4441ef 100644
--- a/src/plugins/sensors/generic/genericalssensor.cpp
+++ b/src/plugins/sensors/generic/genericalssensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "genericalssensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/generic/genericalssensor.h b/src/plugins/sensors/generic/genericalssensor.h
index 3d10b9a1..544f27bb 100644
--- a/src/plugins/sensors/generic/genericalssensor.h
+++ b/src/plugins/sensors/generic/genericalssensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICALSSENSOR_H
#define GENERICALSSENSOR_H
diff --git a/src/plugins/sensors/generic/genericorientationsensor.cpp b/src/plugins/sensors/generic/genericorientationsensor.cpp
index 1bcaaa60..6f880cd8 100644
--- a/src/plugins/sensors/generic/genericorientationsensor.cpp
+++ b/src/plugins/sensors/generic/genericorientationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "genericorientationsensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/generic/genericorientationsensor.h b/src/plugins/sensors/generic/genericorientationsensor.h
index 01265a02..c2f322a7 100644
--- a/src/plugins/sensors/generic/genericorientationsensor.h
+++ b/src/plugins/sensors/generic/genericorientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICORIENTATIONSENSOR_H
#define GENERICORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/generic/genericrotationsensor.cpp b/src/plugins/sensors/generic/genericrotationsensor.cpp
index 40768297..2da1fbca 100644
--- a/src/plugins/sensors/generic/genericrotationsensor.cpp
+++ b/src/plugins/sensors/generic/genericrotationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "genericrotationsensor.h"
#include <QDebug>
diff --git a/src/plugins/sensors/generic/genericrotationsensor.h b/src/plugins/sensors/generic/genericrotationsensor.h
index 98b8f974..cc642298 100644
--- a/src/plugins/sensors/generic/genericrotationsensor.h
+++ b/src/plugins/sensors/generic/genericrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICROTATIONSENSOR_H
#define GENERICROTATIONSENSOR_H
diff --git a/src/plugins/sensors/generic/generictiltsensor.cpp b/src/plugins/sensors/generic/generictiltsensor.cpp
index bb418893..1d17d0d2 100644
--- a/src/plugins/sensors/generic/generictiltsensor.cpp
+++ b/src/plugins/sensors/generic/generictiltsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "generictiltsensor.h"
#include <QDebug>
@@ -161,5 +125,5 @@ bool GenericTiltSensor::filter(QAccelerometerReading *reading)
bool GenericTiltSensor::isFeatureSupported(QSensor::Feature feature) const
{
- return (feature == QSensor::SkipDuplicates);
+ return (feature == QSensor::Feature::SkipDuplicates);
}
diff --git a/src/plugins/sensors/generic/generictiltsensor.h b/src/plugins/sensors/generic/generictiltsensor.h
index 71db69d3..3f7f438d 100644
--- a/src/plugins/sensors/generic/generictiltsensor.h
+++ b/src/plugins/sensors/generic/generictiltsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef GENERICTILTSENSOR_H
#define GENERICTILTSENSOR_H
diff --git a/src/plugins/sensors/generic/main.cpp b/src/plugins/sensors/generic/main.cpp
index 44bfff09..02154b2f 100644
--- a/src/plugins/sensors/generic/main.cpp
+++ b/src/plugins/sensors/generic/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifdef QTSENSORS_GENERICORIENTATIONSENSOR
#include "genericorientationsensor.h"
@@ -68,44 +32,44 @@ public:
void sensorsChanged() override
{
- if (!QSensor::defaultSensorForType(QAccelerometer::type).isEmpty()) {
+ if (!QSensor::defaultSensorForType(QAccelerometer::sensorType).isEmpty()) {
// There is an accelerometer available. Register the backends
#ifdef QTSENSORS_GENERICORIENTATIONSENSOR
- if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id))
- QSensorManager::registerBackend(QOrientationSensor::type, genericorientationsensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QOrientationSensor::sensorType, genericorientationsensor::id))
+ QSensorManager::registerBackend(QOrientationSensor::sensorType, genericorientationsensor::id, this);
#endif
#ifdef QTSENSORS_GENERICROTATIONSENSOR
- if (!QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id))
- QSensorManager::registerBackend(QRotationSensor::type, genericrotationsensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QRotationSensor::sensorType, genericrotationsensor::id))
+ QSensorManager::registerBackend(QRotationSensor::sensorType, genericrotationsensor::id, this);
#endif
#ifdef QTSENSORS_GENERICTILTSENSOR
- if (!QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id))
- QSensorManager::registerBackend(QTiltSensor::type, GenericTiltSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QTiltSensor::sensorType, GenericTiltSensor::id))
+ QSensorManager::registerBackend(QTiltSensor::sensorType, GenericTiltSensor::id, this);
#endif
} else {
#ifdef QTSENSORS_GENERICORIENTATIONSENSOR
- if (QSensorManager::isBackendRegistered(QOrientationSensor::type, genericorientationsensor::id))
- QSensorManager::unregisterBackend(QOrientationSensor::type, genericorientationsensor::id);
+ if (QSensorManager::isBackendRegistered(QOrientationSensor::sensorType, genericorientationsensor::id))
+ QSensorManager::unregisterBackend(QOrientationSensor::sensorType, genericorientationsensor::id);
#endif
#ifdef QTSENSORS_GENERICROTATIONSENSOR
- if (QSensorManager::isBackendRegistered(QRotationSensor::type, genericrotationsensor::id))
- QSensorManager::unregisterBackend(QRotationSensor::type, genericrotationsensor::id);
+ if (QSensorManager::isBackendRegistered(QRotationSensor::sensorType, genericrotationsensor::id))
+ QSensorManager::unregisterBackend(QRotationSensor::sensorType, genericrotationsensor::id);
#endif
#ifdef QTSENSORS_GENERICTILTSENSOR
- if (QSensorManager::isBackendRegistered(QTiltSensor::type, GenericTiltSensor::id))
- QSensorManager::unregisterBackend(QTiltSensor::type, GenericTiltSensor::id);
+ if (QSensorManager::isBackendRegistered(QTiltSensor::sensorType, GenericTiltSensor::id))
+ QSensorManager::unregisterBackend(QTiltSensor::sensorType, GenericTiltSensor::id);
#endif
}
- if (!QSensor::defaultSensorForType(QLightSensor::type).isEmpty()) {
+ if (!QSensor::defaultSensorForType(QLightSensor::sensorType).isEmpty()) {
#ifdef QTSENSORS_GENERICALSSENSOR
- if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id))
- QSensorManager::registerBackend(QAmbientLightSensor::type, genericalssensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::sensorType, genericalssensor::id))
+ QSensorManager::registerBackend(QAmbientLightSensor::sensorType, genericalssensor::id, this);
#endif
} else {
#ifdef QTSENSORS_GENERICALSSENSOR
- if (QSensorManager::isBackendRegistered(QAmbientLightSensor::type, genericalssensor::id))
- QSensorManager::unregisterBackend(QAmbientLightSensor::type, genericalssensor::id);
+ if (QSensorManager::isBackendRegistered(QAmbientLightSensor::sensorType, genericalssensor::id))
+ QSensorManager::unregisterBackend(QAmbientLightSensor::sensorType, genericalssensor::id);
#endif
}
}
@@ -134,4 +98,3 @@ public:
};
#include "main.moc"
-
diff --git a/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt
new file mode 100644
index 00000000..83093e11
--- /dev/null
+++ b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## IIOSensorProxySensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(IIOSensorProxySensorPlugin
+ OUTPUT_NAME qtsensors_iio-sensor-proxy
+ PLUGIN_TYPE sensors
+ SOURCES
+ iiosensorproxycompass.cpp iiosensorproxycompass.h
+ iiosensorproxylightsensor.cpp iiosensorproxylightsensor.h
+ iiosensorproxyorientationsensor.cpp iiosensorproxyorientationsensor.h
+ iiosensorproxysensorbase.cpp iiosensorproxysensorbase.h
+ main.cpp
+ NO_UNITY_BUILD_SOURCES
+ # Duplicate symbol definition between, iiosensorproxycompass.cpp, and
+ # the followings
+ # TODO: dbusPath() can probably be implemented as a static data member
+ iiosensorproxylightsensor.cpp
+ iiosensorproxyorientationsensor.cpp
+ DBUS_INTERFACE_SOURCES
+ org.freedesktop.DBus.Properties.xml
+ net.hadess.SensorProxy.xml
+ net.hadess.SensorProxy.Compass.xml
+ DBUS_INTERFACE_FLAGS
+ "-N"
+ LIBRARIES
+ Qt::Core
+ Qt::DBus
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:iio-sensor-proxy.pro:<TRUE>:
+# OTHER_FILES = "plugin.json" "$$DBUS_INTERFACES"
+# dbus_properties.files = "org.freedesktop.DBus.Properties.xml"
+# dbus_properties.header_flags = "-N"
+# sensor_proxy.files = "net.hadess.SensorProxy.xml"
+# sensor_proxy.header_flags = "-N"
+# sensor_proxy_compass.files = "net.hadess.SensorProxy.Compass.xml"
+# sensor_proxy_compass.header_flags = "-N"
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(IIOSensorProxySensorPlugin CONDITION NOT ANDROID
+ LIBRARIES
+ rt
+)
diff --git a/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro b/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro
deleted file mode 100644
index b68d9fbf..00000000
--- a/src/plugins/sensors/iio-sensor-proxy/iio-sensor-proxy.pro
+++ /dev/null
@@ -1,31 +0,0 @@
-TARGET = qtsensors_iio-sensor-proxy
-QT = core dbus sensors
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = IIOSensorProxySensorPlugin
-load(qt_plugin)
-
-!android:LIBS += -lrt
-HEADERS += iiosensorproxysensorbase.h \
- iiosensorproxylightsensor.h \
- iiosensorproxyorientationsensor.h \
- iiosensorproxycompass.h
-
-SOURCES += iiosensorproxysensorbase.cpp \
- iiosensorproxylightsensor.cpp \
- iiosensorproxyorientationsensor.cpp \
- iiosensorproxycompass.cpp \
- main.cpp
-
-DBUS_INTERFACES += sensor_proxy sensor_proxy_compass dbus_properties
-
-sensor_proxy.files = net.hadess.SensorProxy.xml
-sensor_proxy.header_flags = -N
-
-sensor_proxy_compass.files = net.hadess.SensorProxy.Compass.xml
-sensor_proxy_compass.header_flags = -N
-
-dbus_properties.files = org.freedesktop.DBus.Properties.xml
-dbus_properties.header_flags = -N
-
-OTHER_FILES = plugin.json $$DBUS_INTERFACES
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp
index fd0b0f1f..f25fe574 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxycompass.h"
#include "compass_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h
index 30d79e37..2be0408b 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxycompass.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_COMPASS_H
#define IIOSENSORPROXY_COMPASS_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp
index acd48147..b54126e4 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxylightsensor.h"
#include "sensorproxy_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h
index 14c07d66..bf833815 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxylightsensor.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_LIGHTSENSOR_H
#define IIOSENSORPROXY_LIGHTSENSOR_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp
index 86ebb358..f589870a 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxyorientationsensor.h"
#include "sensorproxy_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h
index 959113f1..0d81d312 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxyorientationsensor.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_ORIENTATIONSENSOR_H
#define IIOSENSORPROXY_ORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp
index 0a9f318c..9d7842f8 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxysensorbase.h"
#include "sensorproxy_interface.h"
diff --git a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h
index 96e036ad..12baedcd 100644
--- a/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h
+++ b/src/plugins/sensors/iio-sensor-proxy/iiosensorproxysensorbase.h
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IIOSENSORPROXY_SENSORBASE_H
#define IIOSENSORPROXY_SENSORBASE_H
diff --git a/src/plugins/sensors/iio-sensor-proxy/main.cpp b/src/plugins/sensors/iio-sensor-proxy/main.cpp
index 580e2c46..06b726a3 100644
--- a/src/plugins/sensors/iio-sensor-proxy/main.cpp
+++ b/src/plugins/sensors/iio-sensor-proxy/main.cpp
@@ -1,42 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Alexander Volkov <a.volkov@rusbitech.ru>
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iiosensorproxyorientationsensor.h"
#include "iiosensorproxylightsensor.h"
@@ -61,12 +25,12 @@ public:
void registerSensors() override
{
if (QDBusConnection::systemBus().interface()->isServiceRegistered("net.hadess.SensorProxy")) {
- if (!QSensorManager::isBackendRegistered(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id))
- QSensorManager::registerBackend(QOrientationSensor::type, IIOSensorProxyOrientationSensor::id, this);
- if (!QSensorManager::isBackendRegistered(QLightSensor::type, IIOSensorProxyLightSensor::id))
- QSensorManager::registerBackend(QLightSensor::type, IIOSensorProxyLightSensor::id, this);
- if (!QSensorManager::isBackendRegistered(QCompass::type, IIOSensorProxyCompass::id))
- QSensorManager::registerBackend(QCompass::type, IIOSensorProxyCompass::id, this);
+ if (!QSensorManager::isBackendRegistered(QOrientationSensor::sensorType, IIOSensorProxyOrientationSensor::id))
+ QSensorManager::registerBackend(QOrientationSensor::sensorType, IIOSensorProxyOrientationSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QLightSensor::sensorType, IIOSensorProxyLightSensor::id))
+ QSensorManager::registerBackend(QLightSensor::sensorType, IIOSensorProxyLightSensor::id, this);
+ if (!QSensorManager::isBackendRegistered(QCompass::sensorType, IIOSensorProxyCompass::id))
+ QSensorManager::registerBackend(QCompass::sensorType, IIOSensorProxyCompass::id, this);
}
}
diff --git a/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml b/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml
index 5dc94f5d..c7a43ca7 100644
--- a/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml
+++ b/src/plugins/sensors/iio-sensor-proxy/org.freedesktop.DBus.Properties.xml
@@ -20,7 +20,7 @@
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
diff --git a/src/plugins/sensors/ios/CMakeLists.txt b/src/plugins/sensors/ios/CMakeLists.txt
new file mode 100644
index 00000000..44f61427
--- /dev/null
+++ b/src/plugins/sensors/ios/CMakeLists.txt
@@ -0,0 +1,59 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## IOSSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(IOSSensorPlugin
+ OUTPUT_NAME qtsensors_ios
+ PLUGIN_TYPE sensors
+ SOURCES
+ main.mm
+ LIBRARIES
+ ${FWFoundation}
+ Qt::Core
+ Qt::Sensors
+)
+
+#### Keys ignored in scope 1:.:.:ios.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
+
+## Scopes:
+#####################################################################
+
+set_target_properties(IOSSensorPlugin
+ PROPERTIES
+ DISABLE_PRECOMPILE_HEADERS ON
+)
+
+qt_internal_extend_target(IOSSensorPlugin CONDITION IOS AND UIKIT
+ SOURCES
+ ioscompass.h ioscompass.mm
+ DEFINES
+ HAVE_COMPASS
+ LIBRARIES
+ ${FWCoreLocation}
+)
+
+qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT TVOS
+ SOURCES
+ iosaccelerometer.h iosaccelerometer.mm
+ iosgyroscope.h iosgyroscope.mm
+ iosmagnetometer.h iosmagnetometer.mm
+ iospressure.h iospressure.mm
+ iosmotionmanager.h iosmotionmanager.mm
+ DEFINES
+ HAVE_COREMOTION
+ LIBRARIES
+ ${FWCoreMotion}
+)
+
+qt_internal_extend_target(IOSSensorPlugin CONDITION UIKIT AND NOT WATCHOS
+ SOURCES
+ iosproximitysensor.h iosproximitysensor.mm
+ DEFINES
+ HAVE_UIDEVICE
+ LIBRARIES
+ ${FWUIKit}
+)
diff --git a/src/plugins/sensors/ios/ios.pro b/src/plugins/sensors/ios/ios.pro
deleted file mode 100644
index 91ec3ae0..00000000
--- a/src/plugins/sensors/ios/ios.pro
+++ /dev/null
@@ -1,49 +0,0 @@
-TARGET = qtsensors_ios
-QT = core sensors
-
-OTHER_FILES = plugin.json
-
-OBJECTIVE_SOURCES += main.mm
-LIBS += -framework Foundation
-
-uikit {
- ios {
- HEADERS += \
- ioscompass.h
- OBJECTIVE_SOURCES += \
- ioscompass.mm
-
- DEFINES += HAVE_COMPASS
- LIBS += -framework CoreLocation
- }
-
- !tvos {
- HEADERS += \
- iosaccelerometer.h \
- iosgyroscope.h \
- iosmagnetometer.h \
- iosmotionmanager.h
- OBJECTIVE_SOURCES += \
- iosaccelerometer.mm \
- iosgyroscope.mm \
- iosmagnetometer.mm \
- iosmotionmanager.mm
-
- DEFINES += HAVE_COREMOTION
- LIBS += -framework CoreMotion
- }
-
- !watchos {
- HEADERS += \
- iosproximitysensor.h
- OBJECTIVE_SOURCES += \
- iosproximitysensor.mm
-
- DEFINES += HAVE_UIDEVICE
- LIBS += -framework UIKit
- }
-}
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = IOSSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/ios/iosaccelerometer.h b/src/plugins/sensors/ios/iosaccelerometer.h
index 4ac73a97..fb8b93b5 100644
--- a/src/plugins/sensors/ios/iosaccelerometer.h
+++ b/src/plugins/sensors/ios/iosaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSACCELEROMETER_H
#define IOSACCELEROMETER_H
diff --git a/src/plugins/sensors/ios/iosaccelerometer.mm b/src/plugins/sensors/ios/iosaccelerometer.mm
index d2d6e9fb..84fd06ad 100644
--- a/src/plugins/sensors/ios/iosaccelerometer.mm
+++ b/src/plugins/sensors/ios/iosaccelerometer.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosaccelerometer.h"
#include "iosmotionmanager.h"
diff --git a/src/plugins/sensors/ios/ioscompass.h b/src/plugins/sensors/ios/ioscompass.h
index 2babc92a..3ebcb4ad 100644
--- a/src/plugins/sensors/ios/ioscompass.h
+++ b/src/plugins/sensors/ios/ioscompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSCompass_H
#define IOSCompass_H
diff --git a/src/plugins/sensors/ios/ioscompass.mm b/src/plugins/sensors/ios/ioscompass.mm
index 7fc48d36..afcdef9f 100644
--- a/src/plugins/sensors/ios/ioscompass.mm
+++ b/src/plugins/sensors/ios/ioscompass.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#import <CoreLocation/CLHeading.h>
#import <CoreLocation/CLLocationManagerDelegate.h>
diff --git a/src/plugins/sensors/ios/iosgyroscope.h b/src/plugins/sensors/ios/iosgyroscope.h
index 0d7fea49..f765a57d 100644
--- a/src/plugins/sensors/ios/iosgyroscope.h
+++ b/src/plugins/sensors/ios/iosgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSGYROSCOPE_H
#define IOSGYROSCOPE_H
diff --git a/src/plugins/sensors/ios/iosgyroscope.mm b/src/plugins/sensors/ios/iosgyroscope.mm
index 8155abac..5310e09b 100644
--- a/src/plugins/sensors/ios/iosgyroscope.mm
+++ b/src/plugins/sensors/ios/iosgyroscope.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosmotionmanager.h"
#include "iosgyroscope.h"
diff --git a/src/plugins/sensors/ios/iosmagnetometer.h b/src/plugins/sensors/ios/iosmagnetometer.h
index 2c55eac3..7388c830 100644
--- a/src/plugins/sensors/ios/iosmagnetometer.h
+++ b/src/plugins/sensors/ios/iosmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSMAGNETOMETER_H
#define IOSMAGNETOMETER_H
diff --git a/src/plugins/sensors/ios/iosmagnetometer.mm b/src/plugins/sensors/ios/iosmagnetometer.mm
index bfbe6e6d..9c60d544 100644
--- a/src/plugins/sensors/ios/iosmagnetometer.mm
+++ b/src/plugins/sensors/ios/iosmagnetometer.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosmotionmanager.h"
#include "iosmagnetometer.h"
@@ -53,7 +17,7 @@ IOSMagnetometer::IOSMagnetometer(QSensor *sensor)
: QSensorBackend(sensor)
, m_motionManager([QIOSMotionManager sharedManager])
, m_timer(0)
- , m_returnGeoValues(false)
+ , m_returnGeoValues(true)
{
setReading<QMagnetometerReading>(&m_reading);
// Technical information about data rate is not found, but
@@ -75,7 +39,7 @@ void IOSMagnetometer::start()
if (m_returnGeoValues) {
if (++s_deviceMotionStartCount == 1)
- [m_motionManager startDeviceMotionUpdates];
+ [m_motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXMagneticNorthZVertical];
} else {
if (++s_magnetometerStartCount == 1)
[m_motionManager startMagnetometerUpdates];
diff --git a/src/plugins/sensors/ios/iosmotionmanager.h b/src/plugins/sensors/ios/iosmotionmanager.h
index 7c2a1b27..cfb1d99f 100644
--- a/src/plugins/sensors/ios/iosmotionmanager.h
+++ b/src/plugins/sensors/ios/iosmotionmanager.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSMOTIONMANAGER_H
#define IOSMOTIONMANAGER_H
diff --git a/src/plugins/sensors/ios/iosmotionmanager.mm b/src/plugins/sensors/ios/iosmotionmanager.mm
index 90741089..3bf2c537 100644
--- a/src/plugins/sensors/ios/iosmotionmanager.mm
+++ b/src/plugins/sensors/ios/iosmotionmanager.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Lorn Potter
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Lorn Potter
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "iosmotionmanager.h"
diff --git a/src/plugins/sensors/ios/iospressure.h b/src/plugins/sensors/ios/iospressure.h
new file mode 100644
index 00000000..f95b9bc4
--- /dev/null
+++ b/src/plugins/sensors/ios/iospressure.h
@@ -0,0 +1,37 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef IOSPRESSURE_H
+#define IOSPRESSURE_H
+
+#include <qsensorbackend.h>
+#include <qpressuresensor.h>
+
+@class CMAltimeter;
+
+QT_BEGIN_NAMESPACE
+
+class IOSPressure : public QSensorBackend
+{
+public:
+ static char const * const id;
+
+ explicit IOSPressure(QSensor *sensor);
+ ~IOSPressure();
+ void timerEvent(QTimerEvent *) override;
+
+ void start() override;
+ void stop() override;
+
+private:
+ Q_DISABLE_COPY_MOVE(IOSPressure)
+ CMAltimeter *m_altimeter = nullptr;
+ QPressureReading m_reading;
+ int m_timer = 0;
+
+ static int s_startCount;
+};
+QT_END_NAMESPACE
+
+#endif // IOSPRESSURE_H
+
diff --git a/src/plugins/sensors/ios/iospressure.mm b/src/plugins/sensors/ios/iospressure.mm
new file mode 100644
index 00000000..d3a9275e
--- /dev/null
+++ b/src/plugins/sensors/ios/iospressure.mm
@@ -0,0 +1,65 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "iospressure.h"
+#import <CoreMotion/CoreMotion.h>
+
+char const * const IOSPressure::id("ios.pressure");
+
+QT_BEGIN_NAMESPACE
+
+int IOSPressure::s_startCount = 0;
+
+IOSPressure::IOSPressure(QSensor *sensor)
+ : QSensorBackend(sensor)
+{
+ m_altimeter = [[CMAltimeter alloc] init];
+ setReading<QPressureReading>(&m_reading);
+ addDataRate(1, 100); // 100Hz
+}
+
+IOSPressure::~IOSPressure()
+{
+ [m_altimeter stopRelativeAltitudeUpdates];
+ [m_altimeter release];
+}
+
+void IOSPressure::start()
+{
+ if (m_timer != 0)
+ return;
+
+ int hz = sensor()->dataRate();
+ m_timer = startTimer(1000 / (hz == 0 ? 60 : hz));
+ if (++s_startCount == 1) {
+ [m_altimeter startRelativeAltitudeUpdatesToQueue:[NSOperationQueue mainQueue]
+ withHandler:^(CMAltitudeData * _Nullable altitudeData , NSError * _Nullable error) {
+ if (error == nil) {
+ m_reading.setPressure([altitudeData.pressure doubleValue] * 1000);
+ m_reading.setTimestamp(quint64(altitudeData.timestamp * 1e6));
+ }
+ }];
+ }
+}
+
+void IOSPressure::stop()
+{
+ if (m_timer == 0)
+ return;
+
+ killTimer(m_timer);
+ m_timer = 0;
+ if (--s_startCount == 0)
+ [m_altimeter stopRelativeAltitudeUpdates];
+}
+
+void IOSPressure::timerEvent(QTimerEvent *)
+{
+ // skip update if NaN or 0
+ if ((m_reading.pressure() != m_reading.pressure()) ||
+ m_reading.pressure() == 0)
+ return;
+ newReadingAvailable();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/sensors/ios/iosproximitysensor.h b/src/plugins/sensors/ios/iosproximitysensor.h
index 0d69391f..09d22650 100644
--- a/src/plugins/sensors/ios/iosproximitysensor.h
+++ b/src/plugins/sensors/ios/iosproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef IOSPROXIMITYSENSOR_H
#define IOSPROXIMITYSENSOR_H
diff --git a/src/plugins/sensors/ios/iosproximitysensor.mm b/src/plugins/sensors/ios/iosproximitysensor.mm
index e596aa5b..903877bf 100644
--- a/src/plugins/sensors/ios/iosproximitysensor.mm
+++ b/src/plugins/sensors/ios/iosproximitysensor.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#import <UIKit/UIDevice.h>
diff --git a/src/plugins/sensors/ios/main.mm b/src/plugins/sensors/ios/main.mm
index d6b98192..9e479de5 100644
--- a/src/plugins/sensors/ios/main.mm
+++ b/src/plugins/sensors/ios/main.mm
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qsensorplugin.h>
#include <qsensorbackend.h>
@@ -47,6 +11,7 @@
#include "iosmagnetometer.h"
#include "ioscompass.h"
#include "iosproximitysensor.h"
+#include "iospressure.h"
#import <CoreLocation/CoreLocation.h>
#ifdef HAVE_COREMOTION
@@ -62,19 +27,21 @@ public:
void registerSensors() override
{
#ifdef HAVE_COREMOTION
- QSensorManager::registerBackend(QAccelerometer::type, IOSAccelerometer::id, this);
+ QSensorManager::registerBackend(QAccelerometer::sensorType, IOSAccelerometer::id, this);
if ([QIOSMotionManager sharedManager].gyroAvailable)
- QSensorManager::registerBackend(QGyroscope::type, IOSGyroscope::id, this);
+ QSensorManager::registerBackend(QGyroscope::sensorType, IOSGyroscope::id, this);
if ([QIOSMotionManager sharedManager].magnetometerAvailable)
- QSensorManager::registerBackend(QMagnetometer::type, IOSMagnetometer::id, this);
+ QSensorManager::registerBackend(QMagnetometer::sensorType, IOSMagnetometer::id, this);
+ if ([CMAltimeter isRelativeAltitudeAvailable])
+ QSensorManager::registerBackend(QPressureSensor::sensorType, IOSPressure::id, this);
#endif
#ifdef HAVE_COMPASS
if ([CLLocationManager headingAvailable])
- QSensorManager::registerBackend(QCompass::type, IOSCompass::id, this);
+ QSensorManager::registerBackend(QCompass::sensorType, IOSCompass::id, this);
#endif
#ifdef HAVE_UIDEVICE
if (IOSProximitySensor::available())
- QSensorManager::registerBackend(QProximitySensor::type, IOSProximitySensor::id, this);
+ QSensorManager::registerBackend(QProximitySensor::sensorType, IOSProximitySensor::id, this);
#endif
}
@@ -87,6 +54,8 @@ public:
return new IOSGyroscope(sensor);
if (sensor->identifier() == IOSMagnetometer::id)
return new IOSMagnetometer(sensor);
+ if (sensor->identifier() == IOSPressure::id)
+ return new IOSPressure(sensor);
#endif
#ifdef HAVE_COMPASS
if (sensor->identifier() == IOSCompass::id)
diff --git a/src/plugins/sensors/linux/linux.pro b/src/plugins/sensors/linux/linux.pro
deleted file mode 100644
index 33706e7d..00000000
--- a/src/plugins/sensors/linux/linux.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET = qtsensors_linuxsys
-QT = core sensors
-
-OTHER_FILES = plugin.json
-
-!android:LIBS += -lrt
-HEADERS += linuxsysaccelerometer.h
-SOURCES += linuxsysaccelerometer.cpp \
-main.cpp
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = LinuxSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/linux/linuxsysaccelerometer.cpp b/src/plugins/sensors/linux/linuxsysaccelerometer.cpp
deleted file mode 100644
index c5c7e375..00000000
--- a/src/plugins/sensors/linux/linuxsysaccelerometer.cpp
+++ /dev/null
@@ -1,188 +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 "linuxsysaccelerometer.h"
-#include <QtCore/QDebug>
-#include <QtCore/QtGlobal>
-#include <QtCore/QFile>
-#include <QtCore/QDebug>
-#include <QtCore/QTimer>
-
-#include <QtCore/QStringList>
-
-#include <time.h>
-#include <errno.h>
-
-char const * const LinuxSysAccelerometer::id("linuxsys.accelerometer");
-
-// This plugin reads the accelerometer from a sys interface.
-
-// test machine (laptop):
-// QT_ACCEL_FILEPATH=/sys/devices/platform/lis3lv02d/position
-// QT_ACCEL_DATADIVISOR=7
-// QT_ACCEL_DELIMITER=,
-
-quint64 produceTimestamp()
-{
- struct timespec tv;
- int ok;
-
-#ifdef CLOCK_MONOTONIC_RAW
- ok = clock_gettime(CLOCK_MONOTONIC_RAW, &tv);
- if (ok != 0)
-#endif
- ok = clock_gettime(CLOCK_MONOTONIC, &tv);
- Q_ASSERT(ok == 0);
-
- quint64 result = (tv.tv_sec * 1000000ULL) + (tv.tv_nsec * 0.001); // scale to microseconds
- return result;
-}
-
-// TODO get output template from env and apply
-// Currently this assumes the output is like:
-// (x,y,z) or x,y,z
-
-LinuxSysAccelerometer::LinuxSysAccelerometer(QSensor *sensor)
- : QSensorBackend(sensor)
- , m_timerid(0)
- , path(QString())
- , divisor(0)
- , delimiter(QString())
-{
- setReading<QAccelerometerReading>(&m_reading);
- addDataRate(1, 100); // 100Hz
- addOutputRange(-22.418, 22.418, 0.17651); // 2G
-// not sure how to retrieve proper range
-
- path = QString::fromLatin1(qgetenv("QT_ACCEL_FILEPATH"));
- bool ok;
- divisor = QString::fromLatin1(qgetenv("QT_ACCEL_DATADIVISOR")).toInt(&ok);
- if (divisor == 0 || !ok) {
- divisor = 1;
- }
- delimiter = QString::fromLatin1(qgetenv("QT_ACCEL_DELIMITER"));
- file.setFileName(path);
-}
-
-LinuxSysAccelerometer::~LinuxSysAccelerometer()
-{
-}
-
-void LinuxSysAccelerometer::start()
-{
- if (m_timerid)
- return;
-
- if (!openFile())
- return;
-
- int dataRate = sensor()->dataRate();
- if (dataRate == 0) {
- if (sensor()->availableDataRates().count())
- dataRate = sensor()->availableDataRates().first().second;
- else
- dataRate = 1;
- }
-
- int interval = 1000 / dataRate;
-
- if (interval)
- m_timerid = startTimer(interval);
-}
-
-void LinuxSysAccelerometer::stop()
-{
- if (m_timerid) {
- killTimer(m_timerid);
- m_timerid = 0;
- }
- closeFile();
-}
-
-void LinuxSysAccelerometer::poll()
-{
- if (!file.isOpen())
- return;
-
- file.seek(0);
- QString str = file.readLine();
- if (str.isEmpty()) {
- return;
- }
- str = str.simplified();
-
- if (!str.at(0).isNumber() && str.at(0) != '-') {
- str.remove(0,1);
- }
-
- if (!str.at(str.size()-1).isNumber()) {
- str.chop(1);
- }
-
- QStringList accelDataList = str.split(delimiter);
-
- m_reading.setTimestamp(produceTimestamp());
- m_reading.setX(-accelDataList.at(0).toFloat() / divisor);
- m_reading.setY(-accelDataList.at(1).toFloat() / divisor);
- m_reading.setZ(-accelDataList.at(2).toFloat() / divisor);
-
- newReadingAvailable();
-}
-
-void LinuxSysAccelerometer::timerEvent(QTimerEvent * /*event*/)
-{
- poll();
-}
-
-bool LinuxSysAccelerometer::openFile()
-{
- if (!path.isEmpty()
- && !file.open(QIODevice::ReadOnly)) {
- qWarning() << "Could not open file" << strerror(errno);
- return false;
- }
- return true;
-}
-
-void LinuxSysAccelerometer::closeFile()
-{
- file.close();
-}
-
-
diff --git a/src/plugins/sensors/linux/linuxsysaccelerometer.h b/src/plugins/sensors/linux/linuxsysaccelerometer.h
deleted file mode 100644
index af89bf77..00000000
--- a/src/plugins/sensors/linux/linuxsysaccelerometer.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 LINUXSYSACCELEROMETER_H
-#define LINUXSYSACCELEROMETER_H
-
-#include <qsensorbackend.h>
-#include <qaccelerometer.h>
-#include <QtCore/QFile>
-
-
-class LinuxSysAccelerometer : public QSensorBackend
-{
-public:
- static char const * const id;
-
- LinuxSysAccelerometer(QSensor *sensor);
- ~LinuxSysAccelerometer();
-
- void start() override;
- void stop() override;
- void poll();
- void timerEvent(QTimerEvent * /*event*/) override;
-
-private:
- QAccelerometerReading m_reading;
- int m_timerid;
-
- bool openFile();
- void closeFile();
- QString path;
- QFile file;
- float divisor;
- QString delimiter;
-};
-
-#endif // LINUXSYSACCELEROMETER_H
-
diff --git a/src/plugins/sensors/linux/main.cpp b/src/plugins/sensors/linux/main.cpp
deleted file mode 100644
index a82ab821..00000000
--- a/src/plugins/sensors/linux/main.cpp
+++ /dev/null
@@ -1,72 +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 "linuxsysaccelerometer.h"
-
-#include <qsensorplugin.h>
-#include <qsensorbackend.h>
-#include <qsensormanager.h>
-
-#include <QtCore/QFile>
-#include <QtCore/QDebug>
-
-class LinuxSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-public:
- void registerSensors() override
- {
- QString path = QString::fromLatin1(qgetenv("QT_ACCEL_FILEPATH"));
- if (!path.isEmpty() && !QSensorManager::isBackendRegistered(QAccelerometer::type, LinuxSysAccelerometer::id))
- QSensorManager::registerBackend(QAccelerometer::type, LinuxSysAccelerometer::id, this);
- }
-
- QSensorBackend *createBackend(QSensor *sensor) override
- {
- if (sensor->identifier() == LinuxSysAccelerometer::id)
- return new LinuxSysAccelerometer(sensor);
-
- return 0;
- }
-};
-
-#include "main.moc"
-
diff --git a/src/plugins/sensors/linux/plugin.json b/src/plugins/sensors/linux/plugin.json
deleted file mode 100644
index f3863f11..00000000
--- a/src/plugins/sensors/linux/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "linux" ] }
diff --git a/src/plugins/sensors/sensorfw/CMakeLists.txt b/src/plugins/sensors/sensorfw/CMakeLists.txt
new file mode 100644
index 00000000..cc5e9dad
--- /dev/null
+++ b/src/plugins/sensors/sensorfw/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## sensorfwSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(sensorfwSensorPlugin
+ OUTPUT_NAME qtsensors_sensorfw
+ PLUGIN_TYPE sensors
+ SOURCES
+ main.cpp
+ sensorfwaccelerometer.cpp sensorfwaccelerometer.h
+ sensorfwals.cpp sensorfwals.h
+ sensorfwcompass.cpp sensorfwcompass.h
+ sensorfwgyroscope.cpp sensorfwgyroscope.h
+ sensorfwirproximitysensor.cpp sensorfwirproximitysensor.h
+ sensorfwlidsensor.cpp sensorfwlidsensor.h
+ sensorfwlightsensor.cpp sensorfwlightsensor.h
+ sensorfwmagnetometer.cpp sensorfwmagnetometer.h
+ sensorfworientationsensor.cpp sensorfworientationsensor.h
+ sensorfwproximitysensor.cpp sensorfwproximitysensor.h
+ sensorfwrotationsensor.cpp sensorfwrotationsensor.h
+ sensorfwsensorbase.cpp sensorfwsensorbase.h
+ sensorfwtapsensor.cpp sensorfwtapsensor.h
+ LIBRARIES
+ Qt::Core
+ Qt::DBus
+ Qt::Network
+ Qt::SensorsPrivate
+ sensorfw
+)
+
+#### Keys ignored in scope 1:.:.:sensorfw.pro:<TRUE>:
+# CONFIGFILES.files = "Sensors.conf"
+# CONFIGFILES.path = "/etc/xdg/QtProject/"
+# INSTALLS = "CONFIGFILES"
+# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/sensors/sensorfw/main.cpp b/src/plugins/sensors/sensorfw/main.cpp
index c1a02a57..9e8b6ac9 100644
--- a/src/plugins/sensors/sensorfw/main.cpp
+++ b/src/plugins/sensors/sensorfw/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwaccelerometer.h"
#include "sensorfwals.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfw.pro b/src/plugins/sensors/sensorfw/sensorfw.pro
deleted file mode 100644
index 63a66117..00000000
--- a/src/plugins/sensors/sensorfw/sensorfw.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qtsensors_sensorfw
-QT = core sensors-private network dbus
-
-include(sensorfw.pri)
-
-QMAKE_USE += sensorfw
-
-CONFIGFILES.files = Sensors.conf
-CONFIGFILES.path = /etc/xdg/QtProject/
-INSTALLS += CONFIGFILES
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = sensorfwSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp
index a1e9840a..38910b3a 100644
--- a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwaccelerometer.h"
@@ -63,7 +27,7 @@ void sensorfwaccelerometer::slotDataAvailable(const XYZ& data)
newReadingAvailable();
}
-void sensorfwaccelerometer::slotFrameAvailable(const QVector<XYZ>& frame)
+void sensorfwaccelerometer::slotFrameAvailable(const QList<XYZ> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -75,7 +39,8 @@ bool sensorfwaccelerometer::doConnect()
Q_ASSERT(m_sensorInterface);
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(XYZ)), this, SLOT(slotDataAvailable(XYZ)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<XYZ>)),this, SLOT(slotFrameAvailable(QVector<XYZ>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<XYZ>)), this,
+ SLOT(slotFrameAvailable(QList<XYZ>)));
}
diff --git a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h
index 89d7bf78..d877a4bb 100644
--- a/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h
+++ b/src/plugins/sensors/sensorfw/sensorfwaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWACCELEROMETER_H
#define SENSORFWACCELEROMETER_H
@@ -66,8 +30,8 @@ private:
bool m_initDone;
private slots:
- void slotDataAvailable(const XYZ& data);
- void slotFrameAvailable(const QVector<XYZ>&);
+ void slotDataAvailable(const XYZ &data);
+ void slotFrameAvailable(const QList<XYZ> &);
};
#endif
diff --git a/src/plugins/sensors/sensorfw/sensorfwals.cpp b/src/plugins/sensors/sensorfw/sensorfwals.cpp
index c43f7648..8701f482 100644
--- a/src/plugins/sensors/sensorfw/sensorfwals.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwals.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwals.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwals.h b/src/plugins/sensors/sensorfw/sensorfwals.h
index 9a71550e..86af858b 100644
--- a/src/plugins/sensors/sensorfw/sensorfwals.h
+++ b/src/plugins/sensors/sensorfw/sensorfwals.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWALS_H
#define SENSORFWALS_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwcompass.cpp b/src/plugins/sensors/sensorfw/sensorfwcompass.cpp
index 252404fa..05dc5672 100644
--- a/src/plugins/sensors/sensorfw/sensorfwcompass.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwcompass.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwcompass.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwcompass.h b/src/plugins/sensors/sensorfw/sensorfwcompass.h
index 9afe9b41..2db3e924 100644
--- a/src/plugins/sensors/sensorfw/sensorfwcompass.h
+++ b/src/plugins/sensors/sensorfw/sensorfwcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWCOMPASS_H
#define SENSORFWCOMPASS_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp b/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp
index cc9c169e..096b6be3 100644
--- a/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwgyroscope.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwgyroscope.h"
@@ -64,7 +28,7 @@ void SensorfwGyroscope::slotDataAvailable(const XYZ& data)
newReadingAvailable();
}
-void SensorfwGyroscope::slotFrameAvailable(const QVector<XYZ>& frame)
+void SensorfwGyroscope::slotFrameAvailable(const QList<XYZ> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -76,7 +40,8 @@ bool SensorfwGyroscope::doConnect()
Q_ASSERT(m_sensorInterface);
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(XYZ)), this, SLOT(slotDataAvailable(XYZ)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<XYZ>)),this, SLOT(slotFrameAvailable(QVector<XYZ>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<XYZ>)), this,
+ SLOT(slotFrameAvailable(QList<XYZ>)));
}
QString SensorfwGyroscope::sensorName() const
diff --git a/src/plugins/sensors/sensorfw/sensorfwgyroscope.h b/src/plugins/sensors/sensorfw/sensorfwgyroscope.h
index d9346a94..97335379 100644
--- a/src/plugins/sensors/sensorfw/sensorfwgyroscope.h
+++ b/src/plugins/sensors/sensorfw/sensorfwgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWGYROSCOPE_H
@@ -68,9 +32,8 @@ private:
bool m_initDone;
static const float MILLI;
private slots:
- void slotDataAvailable(const XYZ& data);
- void slotFrameAvailable(const QVector<XYZ>&);
-
+ void slotDataAvailable(const XYZ &data);
+ void slotFrameAvailable(const QList<XYZ> &);
};
diff --git a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp
index 83714d82..05e4ce67 100644
--- a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwirproximitysensor.h"
#define RM680_PS "/dev/bh1770glc_ps"
diff --git a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h
index ece68a58..d82096a6 100644
--- a/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwirproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWIRPROXIMITYSENSOR_H
#define SENSORFWIRPROXIMITYSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp
index 18661b95..e922096a 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwlidsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwlidsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwlidsensor.h b/src/plugins/sensors/sensorfw/sensorfwlidsensor.h
index 7ee967a9..50d222e9 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlidsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwlidsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Canonical, 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Canonical, Ltd
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWLIDSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp
index 9fc5bef3..cf20cdbe 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwlightsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwlightsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwlightsensor.h b/src/plugins/sensors/sensorfw/sensorfwlightsensor.h
index 9d8faa6c..c3e0fb87 100644
--- a/src/plugins/sensors/sensorfw/sensorfwlightsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwlightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWLIGHTSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp
index 084e6eac..2946f11f 100644
--- a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwmagnetometer.h"
@@ -76,8 +40,7 @@ void SensorfwMagnetometer::slotDataAvailable(const MagneticField& data)
newReadingAvailable();
}
-
-void SensorfwMagnetometer::slotFrameAvailable(const QVector<MagneticField>& frame)
+void SensorfwMagnetometer::slotFrameAvailable(const QList<MagneticField> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -90,8 +53,8 @@ bool SensorfwMagnetometer::doConnect()
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(MagneticField)),
this, SLOT(slotDataAvailable(MagneticField)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<MagneticField>)),
- this, SLOT(slotFrameAvailable(QVector<MagneticField>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<MagneticField>)), this,
+ SLOT(slotFrameAvailable(QList<MagneticField>)));
}
QString SensorfwMagnetometer::sensorName() const
diff --git a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h
index 03f29556..0ba66b62 100644
--- a/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h
+++ b/src/plugins/sensors/sensorfw/sensorfwmagnetometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWMAGNETOMETER_H
#define SENSORFWMAGNETOMETER_H
@@ -69,9 +33,8 @@ private:
bool m_isGeoMagnetometer;
private slots:
- void slotDataAvailable(const MagneticField& data);
- void slotFrameAvailable(const QVector<MagneticField>&);
-
+ void slotDataAvailable(const MagneticField &data);
+ void slotFrameAvailable(const QList<MagneticField> &);
};
#endif
diff --git a/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp b/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp
index f659eb4c..f398b218 100644
--- a/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfworientationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfworientationsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfworientationsensor.h b/src/plugins/sensors/sensorfw/sensorfworientationsensor.h
index fac59fe8..8863b0cd 100644
--- a/src/plugins/sensors/sensorfw/sensorfworientationsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfworientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWORIENTATIONSENSOR_H
#define SENSORFWORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp
index 8eb28705..04eb698b 100644
--- a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwproximitysensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h
index 992db84a..daeabd4d 100644
--- a/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwproximitysensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWPROXIMITYSENSOR_H
#define SENSORFWPROXIMITYSENSOR_H
diff --git a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp
index d884c538..8c99cfb0 100644
--- a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwrotationsensor.h"
@@ -60,7 +24,7 @@ void SensorfwRotationSensor::slotDataAvailable(const XYZ& data)
newReadingAvailable();
}
-void SensorfwRotationSensor::slotFrameAvailable(const QVector<XYZ>& frame)
+void SensorfwRotationSensor::slotFrameAvailable(const QList<XYZ> &frame)
{
for (int i=0, l=frame.size(); i<l; i++) {
slotDataAvailable(frame.at(i));
@@ -72,7 +36,8 @@ bool SensorfwRotationSensor::doConnect()
Q_ASSERT(m_sensorInterface);
if (m_bufferSize==1)
return QObject::connect(m_sensorInterface, SIGNAL(dataAvailable(XYZ)), this, SLOT(slotDataAvailable(XYZ)));
- return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QVector<XYZ>)),this, SLOT(slotFrameAvailable(QVector<XYZ>)));
+ return QObject::connect(m_sensorInterface, SIGNAL(frameAvailable(QList<XYZ>)), this,
+ SLOT(slotFrameAvailable(QList<XYZ>)));
}
QString SensorfwRotationSensor::sensorName() const
diff --git a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h
index f9150f6d..de0fe24d 100644
--- a/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWROTATION_H
@@ -67,8 +31,7 @@ private:
private slots:
void slotDataAvailable(const XYZ& data);
- void slotFrameAvailable(const QVector<XYZ>&);
-
+ void slotFrameAvailable(const QList<XYZ> &);
};
#endif
diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp b/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp
index 27a07ad6..9736857b 100644
--- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwsensorbase.h"
@@ -92,7 +56,7 @@ void SensorfwSensorBase::start()
if (m_sensorInterface) {
// dataRate
QByteArray type = sensor()->type();
- if (type != QTapSensor::type && type != QProximitySensor::type) {
+ if (type != QTapSensor::sensorType && type != QProximitySensor::sensorType) {
int dataRate = sensor()->dataRate();
int interval = dataRate > 0 ? 1000 / dataRate : 0;
// for testing maximum speed
@@ -291,8 +255,8 @@ bool SensorfwSensorBase::initSensorInterface(QString const &name)
// TODO deztructor: Leaking abstraction detected. Just copied code
// from initSensor<>() here, need to
QByteArray type = sensor()->type();
- if ((type == QAmbientLightSensor::type) // SensorFW returns lux values, plugin enumerated values
- || (type == QIRProximitySensor::type) // SensorFW returns raw reflectance values, plugin % of max reflectance
+ if ((type == QAmbientLightSensor::sensorType) // SensorFW returns lux values, plugin enumerated values
+ || (type == QIRProximitySensor::sensorType) // SensorFW returns raw reflectance values, plugin % of max reflectance
|| (name == "accelerometersensor") // SensorFW returns milliGs, plugin m/s^2
|| (name == "magnetometersensor") // SensorFW returns nanoTeslas, plugin Teslas
|| (name == "gyroscopesensor")) // SensorFW returns DSPs, plugin milliDSPs
@@ -330,4 +294,3 @@ bool SensorfwSensorBase::isFeatureSupported(QSensor::Feature feature) const
return false;
}
-
diff --git a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h
index 7e7f5c33..db78017a 100644
--- a/src/plugins/sensors/sensorfw/sensorfwsensorbase.h
+++ b/src/plugins/sensors/sensorfw/sensorfwsensorbase.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWSENSORBASE_H
@@ -101,7 +65,7 @@ protected:
int bufferSize() const;
virtual qreal correctionFactor() const;
bool reinitIsNeeded;
- bool isFeatureSupported(QSensor::Feature feature) const;
+ bool isFeatureSupported(QSensor::Feature feature) const override;
private:
bool initSensorInterface(QString const &);
diff --git a/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp b/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp
index 23498618..95dd794c 100644
--- a/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp
+++ b/src/plugins/sensors/sensorfw/sensorfwtapsensor.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensorfwtapsensor.h"
diff --git a/src/plugins/sensors/sensorfw/sensorfwtapsensor.h b/src/plugins/sensors/sensorfw/sensorfwtapsensor.h
index 7e9edb4c..a8e48a86 100644
--- a/src/plugins/sensors/sensorfw/sensorfwtapsensor.h
+++ b/src/plugins/sensors/sensorfw/sensorfwtapsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SENSORFWTAPSENSOR_H
#define SENSORFWTAPSENSOR_H
diff --git a/src/plugins/sensors/sensors.pro b/src/plugins/sensors/sensors.pro
deleted file mode 100644
index 7fce2071..00000000
--- a/src/plugins/sensors/sensors.pro
+++ /dev/null
@@ -1,45 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += sensors-private
-
-android {
- isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = android generic
-}
-
-qtConfig(sensorfw) {
- isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = sensorfw generic
-}
-
-darwin {
- isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = ios generic
-}
-
-winrt {
- isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = winrt generic
-}
-
-qtHaveModule(simulator) {
- isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = simulator generic
-}
-
-linux {
- isEmpty(SENSORS_PLUGINS): SENSORS_PLUGINS = linux iio-sensor-proxy generic
-}
-
-contains(CONFIG, sensortag) {
- qtHaveModule(bluetooth) {
- SENSORS_PLUGINS = sensortag generic
- } else {
- message("You have configured for sensortag, but Qt Bluetooth module was not found.")
- }
-}
-
-contains(SENSORS_PLUGINS, dummy):SUBDIRS += dummy
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, generic):SUBDIRS += generic
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, simulator):qtHaveModule(simulator):SUBDIRS += simulator
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, linux):linux:SUBDIRS += linux
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, iio-sensor-proxy):linux:qtHaveModule(dbus):SUBDIRS += iio-sensor-proxy
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, android):android:SUBDIRS += android
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, sensorfw):sensorfw:SUBDIRS += sensorfw
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, sensortag):linux:SUBDIRS += sensortag
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, ios):darwin:SUBDIRS += ios
-isEmpty(SENSORS_PLUGINS)|contains(SENSORS_PLUGINS, winrt):winrt:SUBDIRS += winrt
diff --git a/src/plugins/sensors/sensortag/Sensors.conf b/src/plugins/sensors/sensortag/Sensors.conf
deleted file mode 100644
index b8d79752..00000000
--- a/src/plugins/sensors/sensortag/Sensors.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-[Default]
-QAccelerometer=sensortag.accelerometer
-QAmbientLightSensor=sensortag.als
-QCompass=sensortag.compass
-QMagnetometer=sensortag.magnetometer
-QOrientationSensor=sensortag.orientationsensor
-QProximitySensor=sensortag.proximitysensor
-QRotationSensor=sensortag.rotationsensor
-QTapSensor=sensortag.tapsensor
-QLightSensor=sensortag.lightsensor
-QIRProximitySensor=sensortag.irproximitysensor
-QGyroscope=sensortag.gyroscope
-QLidSensor=sensortag.lidsensor
diff --git a/src/plugins/sensors/sensortag/main.cpp b/src/plugins/sensors/sensortag/main.cpp
deleted file mode 100644
index e6dc54e5..00000000
--- a/src/plugins/sensors/sensortag/main.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagaccelerometer.h"
-#include "sensortagals.h"
-#include "sensortagbase.h"
-#include "sensortaggyroscope.h"
-#include "sensortaghumiditysensor.h"
-#include "sensortaglightsensor.h"
-#include "sensortagmagnetometer.h"
-#include "sensortagpressuresensor.h"
-#include "sensortagtemperaturesensor.h"
-
-#include <QtSensors/qsensorplugin.h>
-#include <QtSensors/qsensorbackend.h>
-#include <QtSensors/qsensormanager.h>
-#include <QSettings>
-
-class SensortagSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-
-public:
-
- void registerSensors()
- {
- if (!QSensorManager::isBackendRegistered(QAccelerometer::type, SensorTagAccelerometer::id))
- QSensorManager::registerBackend(QAccelerometer::type, SensorTagAccelerometer::id, this);
-
- if (!QSensorManager::isBackendRegistered(QAmbientLightSensor::type, SensorTagAls::id))
- QSensorManager::registerBackend(QAmbientLightSensor::type, SensorTagAls::id, this);
-
- if (!QSensorManager::isBackendRegistered(QLightSensor::type, SensorTagLightSensor::id))
- QSensorManager::registerBackend(QLightSensor::type, SensorTagLightSensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QAmbientTemperatureSensor::type, SensorTagTemperatureSensor::id))
- QSensorManager::registerBackend(QAmbientTemperatureSensor::type, SensorTagTemperatureSensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QHumiditySensor::type, SensorTagHumiditySensor::id))
- QSensorManager::registerBackend(QHumiditySensor::type, SensorTagHumiditySensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QPressureSensor::type, SensorTagPressureSensor::id))
- QSensorManager::registerBackend(QPressureSensor::type, SensorTagPressureSensor::id, this);
-
- if (!QSensorManager::isBackendRegistered(QGyroscope::type, SensorTagGyroscope::id))
- QSensorManager::registerBackend(QGyroscope::type, SensorTagGyroscope::id, this);
-
- if (!QSensorManager::isBackendRegistered(QMagnetometer::type, SensorTagMagnetometer::id))
- QSensorManager::registerBackend(QMagnetometer::type, SensorTagMagnetometer::id, this);
- }
-
- QSensorBackend *createBackend(QSensor *sensor)
- {
- if (sensor->identifier() == SensorTagAccelerometer::id)
- return new SensorTagAccelerometer(sensor);
- if (sensor->identifier() == SensorTagAls::id)
- return new SensorTagAls(sensor);
- if (sensor->identifier() == SensorTagLightSensor::id)
- return new SensorTagLightSensor(sensor);
- if (sensor->identifier() == SensorTagTemperatureSensor::id)
- return new SensorTagTemperatureSensor(sensor);
- if (sensor->identifier() == SensorTagHumiditySensor::id)
- return new SensorTagHumiditySensor(sensor);
- if (sensor->identifier() == SensorTagPressureSensor::id)
- return new SensorTagPressureSensor(sensor);
- if (sensor->identifier() == SensorTagGyroscope::id)
- return new SensorTagGyroscope(sensor);
- if (sensor->identifier() == SensorTagMagnetometer::id)
- return new SensorTagMagnetometer(sensor);
- return nullptr;
- }
-};
-
-#include "main.moc"
diff --git a/src/plugins/sensors/sensortag/plugin.json b/src/plugins/sensors/sensortag/plugin.json
deleted file mode 100644
index 9a0f4d52..00000000
--- a/src/plugins/sensors/sensortag/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "sensortag" ] }
diff --git a/src/plugins/sensors/sensortag/sensortag.pri b/src/plugins/sensors/sensortag/sensortag.pri
deleted file mode 100644
index d1d60cb1..00000000
--- a/src/plugins/sensors/sensortag/sensortag.pri
+++ /dev/null
@@ -1,22 +0,0 @@
-# Input
-HEADERS += sensortagaccelerometer.h \
- sensortagals.h \
- sensortagbase.h \
- sensortaggyroscope.h \
- sensortaghumiditysensor.h \
- sensortaglightsensor.h \
- sensortagmagnetometer.h \
- sensortagpressuresensor.h \
- sensortagtemperaturesensor.h
-
-SOURCES += main.cpp \
- sensortagaccelerometer.cpp \
- sensortagals.cpp \
- sensortagbase.cpp \
- sensortaggyroscope.cpp \
- sensortaghumiditysensor.cpp \
- sensortaglightsensor.cpp \
- sensortagmagnetometer.cpp \
- sensortagpressuresensor.cpp \
- sensortagtemperaturesensor.cpp
-
diff --git a/src/plugins/sensors/sensortag/sensortag.pro b/src/plugins/sensors/sensortag/sensortag.pro
deleted file mode 100644
index 42252970..00000000
--- a/src/plugins/sensors/sensortag/sensortag.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = qtsensors_sensortag
-QT = core sensors-private bluetooth
-CONFIG += c++11
-
-include(sensortag.pri)
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = SensortagSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/sensortag/sensortagaccelerometer.cpp b/src/plugins/sensors/sensortag/sensortagaccelerometer.cpp
deleted file mode 100644
index b5b582a9..00000000
--- a/src/plugins/sensors/sensortag/sensortagaccelerometer.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 "sensortagaccelerometer.h"
-#include <QtSensors/qsensorbackend.h>
-
-char const * const SensorTagAccelerometer::id("sensortag.accelerometer");
-
-SensorTagAccelerometer::SensorTagAccelerometer(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setDescription(QLatin1String("x, y, and z axes accelerations in m/s^2"));
- setReading<QAccelerometerReading>(&m_reading);
- sensor->setDataRate(50);//set a default rate
-}
-
-void SensorTagAccelerometer::slotDataAvailable(const QAccelerometerReading &data)
-{
- m_reading.setX(data.x());
- m_reading.setY(data.y());
- m_reading.setZ(data.z());
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagAccelerometer::init()
-{
- m_initDone = false;
-}
-
-void SensorTagAccelerometer::start()
-{
- QObject::connect(this, &SensorTagBase::accelDataAvailable,
- this, &SensorTagAccelerometer::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_ACCELEROMETER_SERVICE);
-}
-
-void SensorTagAccelerometer::stop()
-{
- QObject::disconnect(this, &SensorTagBase::accelDataAvailable,
- this, &SensorTagAccelerometer::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_ACCELEROMETER_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortagaccelerometer.h b/src/plugins/sensors/sensortag/sensortagaccelerometer.h
deleted file mode 100644
index 39ad47f6..00000000
--- a/src/plugins/sensors/sensortag/sensortagaccelerometer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGACCELEROMETER_H
-#define SENSORTAGACCELEROMETER_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qaccelerometer.h>
-
-class SensorTagAccelerometer : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagAccelerometer(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- QAccelerometerReading m_reading;
- bool m_initDone = false;
-
-private slots:
- void slotDataAvailable(const QAccelerometerReading &data);
-};
-
-#endif
-// SENSORTAGACCELEROMETER_H
diff --git a/src/plugins/sensors/sensortag/sensortagals.cpp b/src/plugins/sensors/sensortag/sensortagals.cpp
deleted file mode 100644
index 3fe2de4c..00000000
--- a/src/plugins/sensors/sensortag/sensortagals.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagals.h"
-#include "sensortagbase.h"
-#include <QDebug>
-
-char const * const SensorTagAls::id("sensortag.als");
-
-SensorTagAls::SensorTagAls(QSensor *sensor)
- : SensorTagBase(sensor)
- , m_initDone(false)
-{
- init();
- setReading<QAmbientLightReading>(&m_reading);
- setDescription(QLatin1String("ambient light intensity given as 5 pre-defined levels"));
-}
-
-void SensorTagAls::start()
-{
- QObject::connect(this, &SensorTagBase::luxDataAvailable, this, &SensorTagAls::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
-
-void SensorTagAls::stop()
-{
- QObject::disconnect(this, &SensorTagBase::luxDataAvailable, this, &SensorTagAls::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
-
-void SensorTagAls::slotDataAvailable(qreal data)
-{
- QAmbientLightReading::LightLevel level = getLightLevel(data);
- if (level != m_reading.lightLevel()) {
- m_reading.setLightLevel(level);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
- }
-}
-
-QAmbientLightReading::LightLevel SensorTagAls::getLightLevel(int lux)
-{
- if (lux < 0)
- return QAmbientLightReading::Undefined;
- if (lux < 10)
- return QAmbientLightReading::Dark;
- if (lux < 80)
- return QAmbientLightReading::Twilight;
- if (lux < 400)
- return QAmbientLightReading::Light;
- if (lux < 2500)
- return QAmbientLightReading::Bright;
- return QAmbientLightReading::Sunny;
-}
-
-void SensorTagAls::init()
-{
- m_initDone = false;
-}
diff --git a/src/plugins/sensors/sensortag/sensortagals.h b/src/plugins/sensors/sensortag/sensortagals.h
deleted file mode 100644
index 3ef1b928..00000000
--- a/src/plugins/sensors/sensortag/sensortagals.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGALS_H
-#define SENSORTAGALS_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qambientlightsensor.h>
-
-class SensorTagAls : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagAls(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- QAmbientLightReading m_reading;
- bool m_initDone = false;
-private slots:
- void slotDataAvailable(qreal data);
- static QAmbientLightReading::LightLevel getLightLevel(int lux);
-};
-
-#endif
-//SENSORTAGALS_H
diff --git a/src/plugins/sensors/sensortag/sensortagbase.cpp b/src/plugins/sensors/sensortag/sensortagbase.cpp
deleted file mode 100644
index 322a86d7..00000000
--- a/src/plugins/sensors/sensortag/sensortagbase.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2016 Canonical, 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 "sensortagbase.h"
-
-#include <QLowEnergyCharacteristic>
-#include <QtMath>
-#include <QTimer>
-#include <QDeadlineTimer>
-
-Q_GLOBAL_STATIC(SensorTagBasePrivate, sensortagBasePrivate)
-
-SensorTagBasePrivate::SensorTagBasePrivate(QObject *parent)
- : QObject(parent)
-{
- QTimer::singleShot(50, this, &SensorTagBasePrivate::deviceSearch);
-}
-
-void SensorTagBasePrivate::deviceSearch()
-{
- m_deviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
-
- connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,
- this, &SensorTagBasePrivate::deviceFound);
- connect(m_deviceDiscoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error),
- this, &SensorTagBasePrivate::deviceScanError);
- connect(m_deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished,
- this, &SensorTagBasePrivate::scanFinished);
-
- QTimer::singleShot(20000, this, &SensorTagBasePrivate::deviceSearchTimeout); //make sure to timeout
- m_deviceDiscoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
-}
-
-void SensorTagBasePrivate::deviceSearchTimeout()
-{
- if (m_deviceDiscoveryAgent->isActive() && m_control == nullptr) {
- m_deviceDiscoveryAgent->stop();
- qWarning("No Sensor Tag devices found");
- }
-}
-
-void SensorTagBasePrivate::deviceFound(const QBluetoothDeviceInfo &device)
-{
- if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
- const QString idString = QString::fromLatin1(qgetenv("QT_SENSORTAG_ID"));
-
- const QBluetoothAddress watchForAddress(idString);
- //mac uses deviceUuid
- const QUuid watchForId(idString);
-
- bool ok;
-
- if ((!watchForAddress.isNull() && watchForAddress == device.address()) ||
- (!watchForId.isNull() && watchForId == device.deviceUuid())) {
- ok = true;
- }
- if (ok || device.name().contains("SensorTag")) {
-
- m_deviceDiscoveryAgent->stop();
-
- m_control = new QLowEnergyController(device.address(), this);
-
- connect(m_control, &QLowEnergyController::discoveryFinished,
- this, &SensorTagBasePrivate::serviceDiscoveryFinished);
- connect(m_control, &QLowEnergyController::serviceDiscovered,
- this, &SensorTagBasePrivate::serviceDiscovered);
- connect(m_control, QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error),
- this, &SensorTagBasePrivate::controllerError);
- connect(m_control, &QLowEnergyController::connected,
- this, &SensorTagBasePrivate::sensortagDeviceConnected);
- connect(m_control, &QLowEnergyController::disconnected,
- this, &SensorTagBasePrivate::deviceDisconnected);
-
- m_control->connectToDevice();
- }
- }
-}
-
-void SensorTagBasePrivate::serviceDiscoveryFinished()
-{
- discoveryDone = true;
-}
-
-void SensorTagBasePrivate::scanFinished()
-{
- if (m_control == nullptr)
- qWarning("No Sensor Tag devices found");
-}
-
-void SensorTagBasePrivate::deviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
-{
- switch (error) {
- case QBluetoothDeviceDiscoveryAgent::PoweredOffError:
- qWarning("The Bluetooth adaptor is powered off, power it on before doing discovery.");
- break;
- case QBluetoothDeviceDiscoveryAgent::InputOutputError:
- qWarning("Writing or reading from the device resulted in an error.");
- break;
- default:
- qWarning("An unknown error has occurred.");
- break;
- };
-}
-
-void SensorTagBasePrivate::serviceError(QLowEnergyService::ServiceError e)
-{
- switch (e) {
- case QLowEnergyService::DescriptorWriteError:
- qWarning("Cannot obtain SensorTag notifications");
- break;
- default:
- case QLowEnergyService::CharacteristicWriteError:
- qWarning() << "SensorTag service error:" << e;
- break;
- };
-}
-
-void SensorTagBasePrivate::controllerError(QLowEnergyController::Error error)
-{
- qWarning("Cannot connect to remote device.");
- qWarning() << "Controller Error:" << error;
-}
-
-void SensorTagBasePrivate::sensortagDeviceConnected()
-{
- m_control->discoverServices();
-}
-
-void SensorTagBasePrivate::deviceDisconnected()
-{
- if (q_ptr && q_ptr->sensor()->isActive())
- q_ptr->sensorStopped();
-}
-
-void SensorTagBasePrivate::serviceDiscovered(const QBluetoothUuid &gatt)
-{
- if (enabledServiceUuids.contains(gatt)) {
-
- if (gatt == TI_SENSORTAG_LIGHT_SERVICE) {
- lightService = m_control->createServiceObject(gatt, this);
- doConnections(lightService);
- } else if (gatt == TI_SENSORTAG_TEMPERATURE_SERVICE) {
- temperatureService = m_control->createServiceObject(gatt, this);
- doConnections(temperatureService);
- } else if (gatt == TI_SENSORTAG_BAROMETER_SERVICE) {
- barometerService = m_control->createServiceObject(gatt, this);
- doConnections(barometerService);
- } else if (gatt == TI_SENSORTAG_HUMIDTIY_SERVICE) {
- humidityService = m_control->createServiceObject(gatt, this);
- doConnections(humidityService);
- } else if (gatt == TI_SENSORTAG_INFO_SERVICE) {
- infoService = m_control->createServiceObject(gatt, this);
- doConnections(infoService);
- } else if (gatt == TI_SENSORTAG_ACCELEROMETER_SERVICE) {
- acceleratorService = m_control->createServiceObject(gatt, this);
- doConnections(acceleratorService);
- } else if (gatt == TI_SENSORTAG_GYROSCOPE_SERVICE) {
- gyroscopeService = m_control->createServiceObject(gatt, this);
- doConnections(gyroscopeService);
- } else if (gatt == TI_SENSORTAG_MAGNETOMETER_SERVICE) {
- magnetometerService = m_control->createServiceObject(gatt, this);
- doConnections(magnetometerService);
- } else if (movementService == nullptr) {
- if (gatt == TI_SENSORTAG_MOVEMENT_SERVICE) {
- movementService = m_control->createServiceObject(gatt, this);
- doConnections(movementService);
- }
- }
- }
-}
-
-void SensorTagBasePrivate::doConnections(QLowEnergyService *service)
-{
- if (service) {
- connect(service, &QLowEnergyService::stateChanged,
- this, &SensorTagBasePrivate::serviceStateChanged);
-
- connect(service, &QLowEnergyService::characteristicChanged,
- this, &SensorTagBasePrivate::updateCharacteristic);
-
- connect(service,SIGNAL(error(QLowEnergyService::ServiceError)),
- this,SLOT(serviceError(QLowEnergyService::ServiceError)));
-
- if (service->state() == QLowEnergyService::DiscoveryRequired) {
- service->discoverDetails();
- } else if (!enabledServiceUuids.isEmpty()
- && enabledServiceUuids.contains(service->serviceUuid())) {
- enableService(service->serviceUuid());
- }
- }
-}
-
-void SensorTagBasePrivate::serviceStateChanged(QLowEnergyService::ServiceState newState)
-{
- if (newState != QLowEnergyService::ServiceDiscovered)
- return;
-
- QLowEnergyService *m_service = qobject_cast<QLowEnergyService *>(sender());
-
- if (!m_service)
- return;
-
- if (!enabledServiceUuids.isEmpty()
- && enabledServiceUuids.contains(m_service->serviceUuid())) {
- enableService(m_service->serviceUuid());
- }
-}
-
-void SensorTagBasePrivate::enableLight(bool on)
-{
- if (!lightService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_LIGHT_SERVICE);
- if (!lightService)
- return;
-
- const QLowEnergyCharacteristic hrChar = lightService->characteristic(TI_SENSORTAG_LIGHT_CONTROL);
- lightService->writeCharacteristic(hrChar, on ? enableSensorCharacteristic : disableSensorCharacteristic);
-
- const QLowEnergyCharacteristic hrChar2 = lightService->characteristic(TI_SENSORTAG_LIGHT_DATA);
-
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
- lightService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableTemp(bool on)
-{
- if (!temperatureService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_TEMPERATURE_SERVICE);
-
- if (!temperatureService)
- return;
-
- const QLowEnergyCharacteristic hrChar = temperatureService->characteristic(TI_SENSORTAG_IR_TEMPERATURE_CONTROL);
- temperatureService->writeCharacteristic(hrChar,on ? enableSensorCharacteristic : disableSensorCharacteristic);
-
- const QLowEnergyCharacteristic hrChar2 = temperatureService->characteristic(TI_SENSORTAG_IR_TEMPERATURE_DATA);
-
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
- temperatureService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enablePressure(bool on)
-{
- if (!barometerService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_BAROMETER_SERVICE);
- if (!barometerService)
- return;
-
- const QLowEnergyCharacteristic hrChar = barometerService->characteristic(TI_SENSORTAG_BAROMETER_CONTROL);
- barometerService->writeCharacteristic(hrChar, on ? enableSensorCharacteristic : disableSensorCharacteristic);
-
- const QLowEnergyCharacteristic hrChar2 = barometerService->characteristic(TI_SENSORTAG_BAROMETER_DATA);
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
-
- barometerService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableHumidity(bool on)
-{
- if (!humidityService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_HUMIDTIY_SERVICE);
- if (!humidityService)
- return;
-
- const QLowEnergyCharacteristic hrChar = humidityService->characteristic(TI_SENSORTAG_HUMIDTIY_CONTROL);
- humidityService->writeCharacteristic(hrChar, on ? enableSensorCharacteristic : disableSensorCharacteristic);
- const QLowEnergyCharacteristic hrChar2 = humidityService->characteristic(TI_SENSORTAG_HUMIDTIY_DATA);
- if (hrChar2.descriptors().count() > 0) {
- const QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
- humidityService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableMovement(bool on)
-{
- if (!movementService && discoveryDone)
- serviceDiscovered(TI_SENSORTAG_MOVEMENT_SERVICE);
- if (!movementService)
- return;
-
- QByteArray controlCharacteristic;
-
- int movementControl = 0;
- //movement service has different syntax here
- if (on) {
- if (gyroscopeEnabled)
- movementControl += 7;
- if (accelerometerEnabled)
- movementControl += 56;
- if (magnetometerEnabled)
- movementControl += 64;
-
- controlCharacteristic = QByteArray::number(movementControl, 16);
- controlCharacteristic.append("04");
-
- } else {
- controlCharacteristic = "00";
- }
-
- const QLowEnergyCharacteristic hrChar = movementService->characteristic(TI_SENSORTAG_MOVEMENT_CONTROL);
- movementService->writeCharacteristic(hrChar, QByteArray::fromHex(controlCharacteristic));
-
- const QLowEnergyCharacteristic hrChar2 = movementService->characteristic(TI_SENSORTAG_MOVEMENT_DATA);
- if (hrChar2.descriptors().count() > 0) {
- QLowEnergyDescriptor m_notificationDesc = hrChar2.descriptors().at(0);
-
- movementService->writeDescriptor(m_notificationDesc,
- on ? enableNotificationsCharacteristic : disableNotificationsCharacteristic);
- }
-}
-
-void SensorTagBasePrivate::enableService(const QBluetoothUuid &uuid)
-{
- if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE
- || uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE
- || uuid == TI_SENSORTAG_GYROSCOPE_SERVICE) {
-
- if ((uuid != TI_SENSORTAG_MOVEMENT_SERVICE)
- && (accelerometerEnabled || magnetometerEnabled || gyroscopeEnabled))
- return;
-
- if (!enabledServiceUuids.contains(TI_SENSORTAG_MOVEMENT_SERVICE))
- enabledServiceUuids.append(TI_SENSORTAG_MOVEMENT_SERVICE);
-
- if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE)
- accelerometerEnabled = true;
- else if (uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE)
- magnetometerEnabled = true;
- else if (uuid == TI_SENSORTAG_GYROSCOPE_SERVICE)
- gyroscopeEnabled = true;
-
- } else if (!enabledServiceUuids.contains(uuid))
- enabledServiceUuids.append(uuid);
-
- if (discoveryDone) {
-
- if (uuid == TI_SENSORTAG_LIGHT_SERVICE)
- enableLight(true);
- else if (uuid == TI_SENSORTAG_TEMPERATURE_SERVICE)
- enableTemp(true);
- else if (uuid == TI_SENSORTAG_BAROMETER_SERVICE)
- enablePressure(true);
- else if (uuid == TI_SENSORTAG_HUMIDTIY_SERVICE)
- enableHumidity(true);
- else if (uuid == TI_SENSORTAG_MOVEMENT_SERVICE)
- enableMovement(true);
- else if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE)
- enableMovement(true);
- else if (uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE)
- enableMovement(true);
- else if (uuid == TI_SENSORTAG_GYROSCOPE_SERVICE)
- enableMovement(true);
- }
-}
-
-void SensorTagBasePrivate::disableService(const QBluetoothUuid &uuid)
-{
- enabledServiceUuids.removeOne(uuid);
-
- if (uuid == TI_SENSORTAG_LIGHT_SERVICE) {
- enableLight(false);
- } else if (uuid == TI_SENSORTAG_TEMPERATURE_SERVICE) {
- enableTemp(false);
- } else if (uuid == TI_SENSORTAG_BAROMETER_SERVICE) {
- enablePressure(false);
- } else if (uuid == TI_SENSORTAG_HUMIDTIY_SERVICE) {
- enableHumidity(false);
- } else if (uuid == TI_SENSORTAG_MOVEMENT_SERVICE) {
- enableMovement(false);
- } else if (uuid == TI_SENSORTAG_ACCELEROMETER_SERVICE) {
- enableMovement(false);
- accelerometerEnabled = false;
- } else if (uuid == TI_SENSORTAG_MAGNETOMETER_SERVICE) {
- enableMovement(false);
- magnetometerEnabled = false;
- } else if (uuid == TI_SENSORTAG_GYROSCOPE_SERVICE) {
- enableMovement(false);
- gyroscopeEnabled = false;
- }
-}
-
-void SensorTagBasePrivate::updateCharacteristic(const QLowEnergyCharacteristic &c,
- const QByteArray &value)
-{
- if (c.uuid() == TI_SENSORTAG_LIGHT_DATA) {
- convertLux(value);
- } else if (c.uuid()== TI_SENSORTAG_IR_TEMPERATURE_DATA) {
- convertTemperature(value);
- } else if (c.uuid() == TI_SENSORTAG_BAROMETER_DATA) {
- convertBarometer(value);
- } else if (c.uuid()== TI_SENSORTAG_HUMIDTIY_DATA) {
- convertHumidity(value);
- } else if (c.uuid()== TI_SENSORTAG_BAROMETER_DATA) {
- convertBarometer(value);
- } else if ((c.uuid() == TI_SENSORTAG_ACCELEROMETER_DATA
- || c.uuid() == TI_SENSORTAG_MOVEMENT_DATA) && accelerometerEnabled) {
- convertAccelerometer(value);
- } else if ((c.uuid() == TI_SENSORTAG_MAGNETOMETER_DATA
- || c.uuid()== TI_SENSORTAG_MOVEMENT_DATA) && magnetometerEnabled) {
- convertMagnetometer(value);
- } else if ((c.uuid() == TI_SENSORTAG_GYROSCOPE_DATA
- || c.uuid() == TI_SENSORTAG_MOVEMENT_DATA) && gyroscopeEnabled) {
- convertGyroscope(value);
- }
-}
-
-void SensorTagBasePrivate::convertLux(const QByteArray &bytes)
-{
- if (bytes.size() < 1)
- return;
-
- quint16 dat = ((quint16)bytes[1] & 0xFF) << 8;
- dat |= (quint16)(bytes[0] & 0xFF);
-
- qreal lux = dat * .01;
-
- emit luxDataAvailable(lux);
-}
-
-void SensorTagBasePrivate::convertTemperature(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- qint16 objTemp = ((bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00));
- objTemp >>= 2;
- qreal objectTemperature = objTemp * 0.03125;
- // change to this if you want to use the ambient/die temp sensor
- // qreal ambientTemperature = ambTemp / 128.0;
-
- emit tempDataAvailable(objectTemperature);
-}
-
-void SensorTagBasePrivate::convertHumidity(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
- quint16 rawH = (bytes[2] & 0xff) | ((bytes[3] << 8) & 0xff00);
- qreal rHumidity = (qreal)(rawH / 65535) * 100.0;
-
- emit humidityDataAvailable(rHumidity);
-}
-
-void SensorTagBasePrivate::convertBarometer(const QByteArray &bytes)
-{
- if (bytes.size() < 5)
- return;
- quint32 pressure = (bytes[3] & 0xff) | ((bytes[4] << 8) & 0xff00) | ((bytes[5] << 16) & 0xff0000);
-
- qreal mbars = (qreal)pressure / 100.0;
- emit pressureDataAvailable(mbars);
-}
-
-void SensorTagBasePrivate::convertAccelerometer(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- int range = 8;
-
- qint16 X = (qint16)((bytes[8]) + ((bytes[9] << 8)));
- qint16 Y = (qint16)((bytes[6]) + ((bytes[7] << 8)));
- qint16 Z = (qint16)((bytes[10]) + ((bytes[11] << 8)));
-
- accelReading.setX((qreal)(X * 1.0) / (32768 / range) * 9.80665);
- accelReading.setY(-(qreal)(Y * 1.0) / (32768 / range) * 9.80665);
- accelReading.setZ((qreal)(Z * 1.0) / (32768 / range) * 9.80665);
- // TODO needs calibration
-
- emit accelDataAvailable(accelReading);
-}
-
-void SensorTagBasePrivate::convertMagnetometer(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- qreal scale = 6.67100977199; // 32768 / 4912;
- qint16 X = (qint16)((bytes[12]) + ((bytes[13] << 8)));
- qint16 Y = (qint16)((bytes[14]) + ((bytes[15] << 8)));
- qint16 Z = (qint16)((bytes[16]) + ((bytes[17] << 8)));
- // TODO needs calibration
-
- magReading.setX((qreal)(X / scale));
- magReading.setY((qreal)(Y / scale));
- magReading.setZ((qreal)(Z / scale));
-
- emit magDataAvailable(magReading);
-}
-
-void SensorTagBasePrivate::convertGyroscope(const QByteArray &bytes)
-{
- if (bytes.size() < 3)
- return;
-
- qreal scale = 128.0;
- qint16 X = (qint16)((bytes[2]) + ((bytes[3] << 8)));
- qint16 Y = (qint16)((bytes[0]) + ((bytes[1] << 8)));
- qint16 Z = (qint16)((bytes[4]) + ((bytes[5] << 8)));
-
- gyroReading.setX((qreal)(X / scale));
- gyroReading.setY((qreal)(Y / scale));
- gyroReading.setZ((qreal)(Z / scale));
-
- emit gyroDataAvailable(gyroReading);
-}
-
-SensorTagBasePrivate * SensorTagBasePrivate::instance()
-{
- SensorTagBasePrivate *priv = sensortagBasePrivate();
- return priv;
-}
-
-SensorTagBase::SensorTagBase(QSensor *sensor)
- : QSensorBackend(sensor),
- leService(nullptr),
- serviceId(nullptr),
- d_ptr(SensorTagBasePrivate::instance())
-{
- connect(d_ptr, &SensorTagBasePrivate::luxDataAvailable,
- this, &SensorTagBase::luxDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::tempDataAvailable,
- this, &SensorTagBase::tempDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::humidityDataAvailable,
- this, &SensorTagBase::humidityDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::pressureDataAvailable,
- this, &SensorTagBase::pressureDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::accelDataAvailable,
- this, &SensorTagBase::accelDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::gyroDataAvailable,
- this, &SensorTagBase::gyroDataAvailable);
- connect(d_ptr, &SensorTagBasePrivate::magDataAvailable,
- this, &SensorTagBase::magDataAvailable);
-}
-
-SensorTagBase::~SensorTagBase()
-{
-}
-
-void SensorTagBase::start()
-{
-}
-
-void SensorTagBase::stop()
-{
-}
-
-quint64 SensorTagBase::produceTimestamp()
-{
- return QDeadlineTimer::current().deadlineNSecs() / 1000;
-}
-
-
diff --git a/src/plugins/sensors/sensortag/sensortagbase.h b/src/plugins/sensors/sensortag/sensortagbase.h
deleted file mode 100644
index 5d61aacf..00000000
--- a/src/plugins/sensors/sensortag/sensortagbase.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 Canonical, 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 SENSORTAGBASEPRIVATE_H
-#define SENSORTAGBASEPRIVATE_H
-
-#include <QObject>
-#include <QSensorBackend>
-
-#include <QBluetoothDeviceDiscoveryAgent>
-#include <QBluetoothDeviceInfo>
-#include <QLowEnergyController>
-#include <QLowEnergyService>
-
-#include <QAccelerometerReading>
-#include <QGyroscopeReading>
-#include <QMagnetometerReading>
-
-class SensorTagBase;
-
-class SensorTagBasePrivate : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PUBLIC(SensorTagBase)
-public:
- explicit SensorTagBasePrivate(QObject *parent = 0);
-
- QLowEnergyService *lightService = nullptr;
- QLowEnergyService *temperatureService = nullptr;
- QLowEnergyService *barometerService = nullptr;
- QLowEnergyService *humidityService = nullptr;
- QLowEnergyService *movementService = nullptr;
- QLowEnergyService *acceleratorService = nullptr;
- QLowEnergyService *magnetometerService = nullptr;
- QLowEnergyService *gyroscopeService = nullptr;
-
- void enableService(const QBluetoothUuid &uuid);
- void disableService(const QBluetoothUuid &uuid);
-
- static SensorTagBasePrivate *instance();
-
-signals:
- void accelDataAvailable(const QAccelerometerReading &);
- void gyroDataAvailable(const QGyroscopeReading &);
- void magDataAvailable(const QMagnetometerReading &);
-
- void luxDataAvailable(qreal);
- void tempDataAvailable(qreal);
- void humidityDataAvailable(qreal);
- void pressureDataAvailable(qreal);
- void compassDataAvailable(qreal);
-
-public slots:
- void enableLight(bool);
- void enableTemp(bool);
- void enablePressure(bool);
- void enableHumidity(bool);
- void enableMovement(bool);
-
- void deviceFound(const QBluetoothDeviceInfo&);
- void scanFinished();
-
- void deviceScanError(QBluetoothDeviceDiscoveryAgent::Error);
- void serviceDiscovered(const QBluetoothUuid &);
-
- void controllerError(QLowEnergyController::Error);
-
- void sensortagDeviceConnected();
- void deviceDisconnected();
-
- void serviceStateChanged(QLowEnergyService::ServiceState s);
- void updateCharacteristic(const QLowEnergyCharacteristic &c,
- const QByteArray &value);
- void serviceError(QLowEnergyService::ServiceError e);
- void doConnections(QLowEnergyService *service);
-
-private slots:
- void deviceSearch();
- void serviceDiscoveryFinished();
- void deviceSearchTimeout();
-
-private:
-
- void convertLux(const QByteArray &value);
- void convertTemperature(const QByteArray &value);
- void convertBarometer(const QByteArray &value);
- void convertHumidity(const QByteArray &value);
- void convertAccelerometer(const QByteArray &value);
- void convertMagnetometer(const QByteArray &value);
- void convertGyroscope(const QByteArray &value);
-
- QBluetoothDeviceDiscoveryAgent *m_deviceDiscoveryAgent = nullptr;
- QLowEnergyDescriptor m_notificationDesc;
-
- QLowEnergyController *m_control = nullptr;
- QLowEnergyService *infoService = nullptr;
-
- QAccelerometerReading accelReading;
- QGyroscopeReading gyroReading;
- QMagnetometerReading magReading;
-
- bool discoveryDone = false;
- QList <QBluetoothUuid> enabledServiceUuids;
- SensorTagBase *q_ptr;
-
- bool accelerometerEnabled = false;
- bool gyroscopeEnabled = false;
- bool magnetometerEnabled = false;
-
- const QByteArray enableSensorCharacteristic = QByteArrayLiteral("\x01");
- const QByteArray disableSensorCharacteristic = QByteArrayLiteral("\x00");
-
- const QByteArray enableNotificationsCharacteristic = QByteArrayLiteral("\x01\x00");
- const QByteArray disableNotificationsCharacteristic = QByteArrayLiteral("\x00\x00");
-};
-
-const QBluetoothUuid TI_SENSORTAG_TEMPERATURE_SERVICE(QUuid("{f000aa00-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IR_TEMPERATURE_DATA(QUuid("{f000aa01-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IR_TEMPERATURE_CONTROL(QUuid("{f000aa02-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IR_TEMPERATURE_PERIOD(QUuid("{f000aa03-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_SERVICE(QUuid("{f000aa10-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_DATA(QUuid("{f000aa11-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_CONTROL(QUuid("{f000aa12-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_ACCELEROMETER_PERIOD(QUuid("{f000aa13-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_SERVICE(QUuid("{f000aa20-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_DATA(QUuid("{f000aa21-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_CONTROL(QUuid("{f000aa22-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_HUMIDTIY_PERIOD(QUuid("{f000aa23-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_SERVICE(QUuid("{f000aa30-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_DATA(QUuid("{f000aa31-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_CONTROL(QUuid("{f000aa32-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MAGNETOMETER_PERIOD(QUuid("{f000aa33-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_SERVICE(QUuid("{f000aa40-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_DATA(QUuid("{f000aa41-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_CONTROL(QUuid("{f000aa42-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_CALIBRATION(QUuid("{f000aa43-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_BAROMETER_PERIOD(QUuid("{f000aa44-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_SERVICE(QUuid("{f000aa50-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_DATA(QUuid("{f000aa51-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_CONTROL(QUuid("{f000aa52-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_GYROSCOPE_PERIOD(QUuid("{f000aa53-0451-4000-b000-000000000000}"));
-
-// test service "{f000aa60-0451-4000-b000-000000000000}"
-
-const QBluetoothUuid TI_SENSORTAG_IO_SERVICE(QUuid("{f000aa64-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IO_DATA(QUuid("{f000aa65-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_IO_CONTROL(QUuid("{f000aa66-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_LIGHT_SERVICE(QUuid("{f000aa70-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_LIGHT_DATA(QUuid("{f000aa71-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_LIGHT_CONTROL(QUuid("{f000aa72-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_LIGHT_PERIOD(QUuid("{f000aa73-0451-4000-b000-000000000000}"));
-
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_SERVICE(QUuid("{f000aa80-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_DATA(QUuid("{f000aa81-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_CONTROL(QUuid("{f000aa82-0451-4000-b000-000000000000}"));
-const QBluetoothUuid TI_SENSORTAG_MOVEMENT_PERIOD(QUuid("{f000aa83-0451-4000-b000-000000000000}"));
-
-// keypress "{f000ffe0-0000-1000-8000-00805f9b34fb"
-
-// Connection Control Service "{f000ccc0-0451-4000-b000-000000000000}"
-// OAD (over air download) Service "{f000ffc0-0451-4000-b000-000000000000}"
-
-const QBluetoothUuid TI_SENSORTAG_INFO_SERVICE(QUuid("{0000180a-0000-1000-8000-00805f9b34fb}"));
-//we might want to use these somehow
-//const QBluetoothUuid TI_SENSORTAG_BATTERY_SERVICE "180F"
-//const QBluetoothUuid TI_SENSORTAG_BATTERY_BATTERY_LEVEL "2A19"
-
-// {00001800-0000-1000-8000-00805f9b34fb} //Generic Access Service
-// {00001801-0000-1000-8000-00805f9b34fb} //Generic Attribute Service
-
-class SensorTagBase : public QSensorBackend
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(SensorTagBase)
-public:
- SensorTagBase(QSensor *sensor);
- virtual ~SensorTagBase();
-
- quint64 produceTimestamp();
-signals:
- void accelDataAvailable(const QAccelerometerReading &);
- void luxDataAvailable(qreal);
- void tempDataAvailable(qreal);
- void humidityDataAvailable(qreal);
- void pressureDataAvailable(qreal);
- void gyroDataAvailable(const QGyroscopeReading &);
- void magDataAvailable(const QMagnetometerReading &);
-
-protected:
- void start() override;
- void stop() override;
- QLowEnergyService *leService;
- QBluetoothUuid *serviceId;
-
-private:
- SensorTagBasePrivate *d_ptr;
- friend class SensorTagTemperatureSensor;
- friend class SensorTagAls;
- friend class SensorTagHumiditySensor;
- friend class SensorTagLightSensor;
-
- friend class SensorTagPressureSensor;
- friend class SensorTagAccelerometer;
-
- friend class SensorTagGyroscope;
- friend class SensorTagMagnetometer;
-};
-
-#endif // SENSORTAGBASEPRIVATE_H
diff --git a/src/plugins/sensors/sensortag/sensortaggyroscope.cpp b/src/plugins/sensors/sensortag/sensortaggyroscope.cpp
deleted file mode 100644
index 136d1433..00000000
--- a/src/plugins/sensors/sensortag/sensortaggyroscope.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortaggyroscope.h"
-
-char const * const SensorTagGyroscope::id("sensortag.gyroscope");
-const float SensorTagGyroscope::MILLI = 0.001;
-
-SensorTagGyroscope::SensorTagGyroscope(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setDescription(QLatin1String("angular velocities around x, y, and z axis in degrees per second"));
- setReading<QGyroscopeReading>(&m_reading);
- sensor->setDataRate(50);//set a default rate
-}
-
-void SensorTagGyroscope::slotDataAvailable(const QGyroscopeReading& data)
-{
- m_reading.setX(data.x());
- m_reading.setY(data.y());
- m_reading.setZ(data.z());
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagGyroscope::init()
-{
- m_initDone = false;
-}
-
-void SensorTagGyroscope::start()
-{
- QObject::connect(this, &SensorTagBase::gyroDataAvailable,
- this, &SensorTagGyroscope::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_GYROSCOPE_SERVICE);
-}
-
-
-void SensorTagGyroscope::stop()
-{
- QObject::disconnect(this, &SensorTagBase::gyroDataAvailable,
- this, &SensorTagGyroscope::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_GYROSCOPE_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortaggyroscope.h b/src/plugins/sensors/sensortag/sensortaggyroscope.h
deleted file mode 100644
index af3cfe41..00000000
--- a/src/plugins/sensors/sensortag/sensortaggyroscope.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGGYROSCOPE_H
-#define SENSORTAGGYROSCOPE_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qgyroscope.h>
-
-class SensorTagGyroscope : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagGyroscope(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- QGyroscopeReading m_reading;
- bool m_initDone = false;
- static const float MILLI;
-private slots:
- void slotDataAvailable(const QGyroscopeReading &data);
-};
-
-#endif // SENSORTAGGYROSCOPE_H
diff --git a/src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp b/src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp
deleted file mode 100644
index 77b4585c..00000000
--- a/src/plugins/sensors/sensortag/sensortaghumiditysensor.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortaghumiditysensor.h"
-#include "sensortagbase.h"
-
-char const * const SensorTagHumiditySensor::id("sensortag.humidity");
-
-SensorTagHumiditySensor::SensorTagHumiditySensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- setReading<QHumidityReading>(&m_reading);
-}
-
-
-void SensorTagHumiditySensor::humidityChanged(qreal value)
-{
- m_reading.setRelativeHumidity(value);
-
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagHumiditySensor::start()
-{
- QObject::connect(this, &SensorTagBase::humidityDataAvailable,
- this, &SensorTagHumiditySensor::humidityChanged);
- d_ptr->enableService(TI_SENSORTAG_HUMIDTIY_SERVICE);
-}
-
-void SensorTagHumiditySensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::humidityDataAvailable,
- this, &SensorTagHumiditySensor::humidityChanged);
- d_ptr->disableService(TI_SENSORTAG_HUMIDTIY_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortaghumiditysensor.h b/src/plugins/sensors/sensortag/sensortaghumiditysensor.h
deleted file mode 100644
index 5511bf05..00000000
--- a/src/plugins/sensors/sensortag/sensortaghumiditysensor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGHUMIDITYSENSOR_H
-#define SENSORTAGHUMIDITYSENSOR_H
-
-#include "sensortagbase.h"
-#include <QHumidityReading>
-
-class SensorTagHumiditySensor : public SensorTagBase
-{
- Q_OBJECT
-public:
- SensorTagHumiditySensor(QSensor *sensor);
- static char const * const id;
-protected:
- void start() override;
- void stop() override;
-private slots:
- void humidityChanged(qreal value);
-private:
- QHumidityReading m_reading;
-};
-
-#endif // SENSORTAGHUMIDITYSENSOR_H
diff --git a/src/plugins/sensors/sensortag/sensortaglightsensor.cpp b/src/plugins/sensors/sensortag/sensortaglightsensor.cpp
deleted file mode 100644
index 9e4038b3..00000000
--- a/src/plugins/sensors/sensortag/sensortaglightsensor.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortaglightsensor.h"
-
-char const * const SensorTagLightSensor::id("sensortag.lightsensor");
-
-SensorTagLightSensor::SensorTagLightSensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setReading<QLightReading>(&m_reading);
- sensor->setDataRate(10);//set a default rate
-}
-
-void SensorTagLightSensor::slotDataAvailable(qreal data)
-{
- m_reading.setLux(data);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagLightSensor::init()
-{
- m_initDone = false;
-}
-
-void SensorTagLightSensor::start()
-{
- QObject::connect(this, &SensorTagBase::luxDataAvailable,
- this, &SensorTagLightSensor::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
-
-void SensorTagLightSensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::luxDataAvailable,
- this, &SensorTagLightSensor::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_LIGHT_SERVICE);
-}
diff --git a/src/plugins/sensors/sensortag/sensortaglightsensor.h b/src/plugins/sensors/sensortag/sensortaglightsensor.h
deleted file mode 100644
index edff8263..00000000
--- a/src/plugins/sensors/sensortag/sensortaglightsensor.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGLIGHTSENSOR_H
-#define SENSORTAGLIGHTSENSOR_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qlightsensor.h>
-
-class SensorTagLightSensor : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagLightSensor(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-private:
- QLightReading m_reading;
- bool m_initDone = false;
-private slots:
- void slotDataAvailable(qreal data);
-};
-
-#endif
-//SENSORTAGLIGHTSENSOR_H
diff --git a/src/plugins/sensors/sensortag/sensortagmagnetometer.cpp b/src/plugins/sensors/sensortag/sensortagmagnetometer.cpp
deleted file mode 100644
index d5d46221..00000000
--- a/src/plugins/sensors/sensortag/sensortagmagnetometer.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagmagnetometer.h"
-
-char const * const SensorTagMagnetometer::id("sensortag.magnetometer");
-const float SensorTagMagnetometer::NANO = 0.000000001;
-
-SensorTagMagnetometer::SensorTagMagnetometer(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- init();
- setDescription(QLatin1String("magnetic flux density in teslas (T)"));
- setReading<QMagnetometerReading>(&m_reading);
-}
-
-void SensorTagMagnetometer::start()
-{
- QObject::connect(this, &SensorTagBase::magDataAvailable,
- this, &SensorTagMagnetometer::slotDataAvailable);
- d_ptr->enableService(TI_SENSORTAG_MAGNETOMETER_SERVICE);
-}
-
-void SensorTagMagnetometer::stop()
-{
- QObject::disconnect(this, &SensorTagBase::magDataAvailable,
- this, &SensorTagMagnetometer::slotDataAvailable);
- d_ptr->disableService(TI_SENSORTAG_MAGNETOMETER_SERVICE);
-}
-
-void SensorTagMagnetometer::slotDataAvailable(const QMagnetometerReading &data)
-{
- m_reading.setX(data.x());
- m_reading.setY(data.y());
- m_reading.setZ(data.z());
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagMagnetometer::init()
-{
- m_initDone = false;
-}
diff --git a/src/plugins/sensors/sensortag/sensortagmagnetometer.h b/src/plugins/sensors/sensortag/sensortagmagnetometer.h
deleted file mode 100644
index 424727a2..00000000
--- a/src/plugins/sensors/sensortag/sensortagmagnetometer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGMAGNETOMETER_H
-#define SENSORTAGMAGNETOMETER_H
-
-#include "sensortagbase.h"
-#include <QtSensors/qmagnetometer.h>
-
-class SensorTagMagnetometer : public SensorTagBase
-{
- Q_OBJECT
-
-public:
- static char const * const id;
- SensorTagMagnetometer(QSensor *sensor);
-protected:
- void start() override;
- void stop() override;
- virtual void init();
-
-private:
- static const float NANO;
- QMagnetometerReading m_reading;
- bool m_initDone = false;
-
-private slots:
- void slotDataAvailable(const QMagnetometerReading &data);
-};
-
-#endif
-//SENSORTAGMAGNETOMETER_H
diff --git a/src/plugins/sensors/sensortag/sensortagpressuresensor.cpp b/src/plugins/sensors/sensortag/sensortagpressuresensor.cpp
deleted file mode 100644
index 7d2c8f93..00000000
--- a/src/plugins/sensors/sensortag/sensortagpressuresensor.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagpressuresensor.h"
-#include "sensortagbase.h"
-
-char const * const SensorTagPressureSensor::id("sensortag.pressure");
-
-SensorTagPressureSensor::SensorTagPressureSensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- setReading<QPressureReading>(&m_reading);
-}
-
-void SensorTagPressureSensor::pressureChanged(qreal value)
-{
- m_reading.setPressure(value);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagPressureSensor::start()
-{
- QObject::connect(this, &SensorTagBase::pressureDataAvailable,
- this, &SensorTagPressureSensor::pressureChanged);
- d_ptr->enableService(TI_SENSORTAG_BAROMETER_SERVICE);
-}
-
-void SensorTagPressureSensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::pressureDataAvailable,
- this, &SensorTagPressureSensor::pressureChanged);
- d_ptr->disableService(TI_SENSORTAG_BAROMETER_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortagpressuresensor.h b/src/plugins/sensors/sensortag/sensortagpressuresensor.h
deleted file mode 100644
index 5f8b0cfd..00000000
--- a/src/plugins/sensors/sensortag/sensortagpressuresensor.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGPRESSURESENSOR_H
-#define SENSORTAGPRESSURESENSOR_H
-
-#include "sensortagbase.h"
-#include <QObject>
-#include <QPressureReading>
-
-class SensorTagPressureSensor : public SensorTagBase
-{
- Q_OBJECT
-public:
- SensorTagPressureSensor(QSensor *sensor);
- static char const * const id;
-
-protected:
- void start() override;
- void stop() override;
-
-private slots:
- void pressureChanged(qreal value);
-private:
- QPressureReading m_reading;
-};
-
-#endif // SENSORTAGPRESSURESENSOR_H
diff --git a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp b/src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp
deleted file mode 100644
index ab8c4a2f..00000000
--- a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 The Qt Company Ltd.
-** Copyright (C) 2016 Canonical, 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 "sensortagtemperaturesensor.h"
-#include "sensortagbase.h"
-
-char const * const SensorTagTemperatureSensor::id("sensortag.temperature");
-
-SensorTagTemperatureSensor::SensorTagTemperatureSensor(QSensor *sensor)
- : SensorTagBase(sensor)
-{
- setReading<QAmbientTemperatureReading>(&m_reading);
-}
-
-void SensorTagTemperatureSensor::temperatureChanged(qreal value)
-{
- m_reading.setTemperature(value);
- m_reading.setTimestamp(produceTimestamp());
- newReadingAvailable();
-}
-
-void SensorTagTemperatureSensor::start()
-{
- QObject::connect(this, &SensorTagBase::tempDataAvailable,
- this, &SensorTagTemperatureSensor::temperatureChanged);
- d_ptr->enableService(TI_SENSORTAG_TEMPERATURE_SERVICE);
-}
-
-void SensorTagTemperatureSensor::stop()
-{
- QObject::disconnect(this, &SensorTagBase::tempDataAvailable,
- this, &SensorTagTemperatureSensor::temperatureChanged);
- d_ptr->disableService(TI_SENSORTAG_TEMPERATURE_SERVICE);
-}
-
diff --git a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.h b/src/plugins/sensors/sensortag/sensortagtemperaturesensor.h
deleted file mode 100644
index c4c45d58..00000000
--- a/src/plugins/sensors/sensortag/sensortagtemperaturesensor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Lorn Potter
-** Copyright (C) 2017 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 SENSORTAGTEMPERATURESENSOR_H
-#define SENSORTAGTEMPERATURESENSOR_H
-
-#include "sensortagbase.h"
-#include <QAmbientTemperatureReading>
-
-class SensorTagTemperatureSensor : public SensorTagBase
-{
- Q_OBJECT
-public:
- SensorTagTemperatureSensor(QSensor *sensor);
- static char const * const id;
-protected:
- void start() override;
- void stop() override;
-private slots:
- void temperatureChanged(qreal value);
-private:
- QAmbientTemperatureReading m_reading;
-};
-
-#endif // SENSORTAGTEMPERATURESENSOR_H
diff --git a/src/plugins/sensors/simulator/main.cpp b/src/plugins/sensors/simulator/main.cpp
deleted file mode 100644
index 167711a9..00000000
--- a/src/plugins/sensors/simulator/main.cpp
+++ /dev/null
@@ -1,143 +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 "simulatoraccelerometer.h"
-#include "simulatorambientlightsensor.h"
-#include "simulatorlightsensor.h"
-#include "simulatorcompass.h"
-#include "simulatorproximitysensor.h"
-#include "simulatorirproximitysensor.h"
-#include "simulatormagnetometer.h"
-#include <QSensorPluginInterface>
-#include <QSensorBackend>
-#include <QSensorManager>
-
-class SimulatorSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface)
-public:
- SimulatorSensorPlugin()
- {
- SensorsConnection *connection = SensorsConnection::instance();
- if (!connection) return; // hardly likely but just in case...
- connect(connection, SIGNAL(setAvailableFeatures(quint32)), this, SLOT(setAvailableFeatures(quint32)));
- }
-
- void registerSensors() override
- {
- QSensorManager::registerBackend(QAccelerometer::type, SimulatorAccelerometer::id, this);
- QSensorManager::registerBackend(QAmbientLightSensor::type, SimulatorAmbientLightSensor::id, this);
- QSensorManager::registerBackend(QLightSensor::type, SimulatorLightSensor::id, this);
- QSensorManager::registerBackend(QCompass::type, SimulatorCompass::id, this);
- QSensorManager::registerBackend(QProximitySensor::type, SimulatorProximitySensor::id, this);
- QSensorManager::registerBackend(QIRProximitySensor::type, SimulatorIRProximitySensor::id, this);
- QSensorManager::registerBackend(QMagnetometer::type, SimulatorMagnetometer::id, this);
- }
-
- QSensorBackend *createBackend(QSensor *sensor) override
- {
- if (sensor->identifier() == SimulatorAccelerometer::id) {
- return new SimulatorAccelerometer(sensor);
- }
-
- if (sensor->identifier() == SimulatorAmbientLightSensor::id) {
- return new SimulatorAmbientLightSensor(sensor);
- }
-
- if (sensor->identifier() == SimulatorLightSensor::id) {
- return new SimulatorLightSensor(sensor);
- }
-
- if (sensor->identifier() == SimulatorProximitySensor::id) {
- return new SimulatorProximitySensor(sensor);
- }
-
- if (sensor->identifier() == SimulatorIRProximitySensor::id) {
- return new SimulatorIRProximitySensor(sensor);
- }
-
- if (sensor->identifier() == SimulatorCompass::id) {
- return new SimulatorCompass(sensor);
- }
-
- if (sensor->identifier() == SimulatorMagnetometer::id) {
- return new SimulatorMagnetometer(sensor);
- }
-
- return 0;
- }
-
- // Copied from the emulator codebase
- enum Features {
- Accelerometer = 0x01,
- Magnetometer = 0x02,
- Compass = 0x04,
- Infraredsensor = 0x08,
- Lightsensor = 0x10
- };
-
-public slots:
- void setAvailableFeatures(quint32 features)
- {
- check(features&Accelerometer, QAccelerometer::type, SimulatorAccelerometer::id);
- check(features&Lightsensor, QLightSensor::type, SimulatorLightSensor::id);
- check(features&Lightsensor, QAmbientLightSensor::type, SimulatorAmbientLightSensor::id);
- check(features&Magnetometer, QMagnetometer::type, SimulatorMagnetometer::id);
- check(features&Compass, QCompass::type, SimulatorCompass::id);
- check(features&Infraredsensor, QIRProximitySensor::type, SimulatorIRProximitySensor::id);
- check(features&Infraredsensor, QProximitySensor::type, SimulatorProximitySensor::id);
- }
-
-private:
- void check(bool test, const QByteArray &type, const QByteArray &id)
- {
- if (test) {
- if (!QSensorManager::isBackendRegistered(type, id))
- QSensorManager::registerBackend(type, id, this);
- } else {
- if (QSensorManager::isBackendRegistered(type, id))
- QSensorManager::unregisterBackend(type, id);
- }
- }
-};
-
-#include "main.moc"
-
diff --git a/src/plugins/sensors/simulator/plugin.json b/src/plugins/sensors/simulator/plugin.json
deleted file mode 100644
index 77f47afe..00000000
--- a/src/plugins/sensors/simulator/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "simulator" ] }
diff --git a/src/plugins/sensors/simulator/qsensordata_simulator.cpp b/src/plugins/sensors/simulator/qsensordata_simulator.cpp
deleted file mode 100644
index 3e590d66..00000000
--- a/src/plugins/sensors/simulator/qsensordata_simulator.cpp
+++ /dev/null
@@ -1,143 +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 "qsensordata_simulator_p.h"
-
-#include <QtCore/QDataStream>
-
-namespace QtMobility {
-
-void qt_registerSensorTypes()
-{
- qRegisterMetaTypeStreamOperators<QAmbientLightReadingData>("QtMobility::QAmbientLightReadingData");
- qRegisterMetaTypeStreamOperators<QLightReadingData>("QtMobility::QLightReadingData");
- qRegisterMetaTypeStreamOperators<QAccelerometerReadingData>("QtMobility::QAccelerometerReadingData");
- qRegisterMetaTypeStreamOperators<QCompassReadingData>("QtMobility::QCompassReadingData");
- qRegisterMetaTypeStreamOperators<QProximityReadingData>("QtMobility::QProximityReadingData");
- qRegisterMetaTypeStreamOperators<QIRProximityReadingData>("QtMobility::QIRProximityReadingData");
- qRegisterMetaTypeStreamOperators<QMagnetometerReadingData>("QtMobility::QMagnetometerReadingData");
-}
-
-QDataStream &operator<<(QDataStream &out, const QAmbientLightReadingData &s)
-{
- out << static_cast<qint32>(s.lightLevel) << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QAmbientLightReadingData &s)
-{
- qint32 lightLevel;
- in >> lightLevel >> s.timestamp;
- s.lightLevel = static_cast<SimulatorLightLevel>(lightLevel);
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QLightReadingData &s)
-{
- out << s.lux << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QLightReadingData &s)
-{
- in >> s.lux >> s.timestamp;
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QAccelerometerReadingData &s)
-{
- out << s.x << s.y << s.z << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QAccelerometerReadingData &s)
-{
- in >> s.x >> s.y >> s.z >> s.timestamp;
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QCompassReadingData &s)
-{
- out << s.azimuth << s.calibrationLevel << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QCompassReadingData &s)
-{
- in >> s.azimuth >> s.calibrationLevel >> s.timestamp;
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QProximityReadingData &s)
-{
- out << s.close << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QProximityReadingData &s)
-{
- in >> s.close >> s.timestamp;
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QIRProximityReadingData &s)
-{
- out << s.irProximity << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QIRProximityReadingData &s)
-{
- in >> s.irProximity >> s.timestamp;
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QMagnetometerReadingData &s)
-{
- out << s.x << s.y << s.z << s.calibrationLevel << s.timestamp;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QMagnetometerReadingData &s)
-{
- in >> s.x >> s.y >> s.z >> s.calibrationLevel >> s.timestamp;
- return in;
-}
-
-} // namespace
diff --git a/src/plugins/sensors/simulator/qsensordata_simulator_p.h b/src/plugins/sensors/simulator/qsensordata_simulator_p.h
deleted file mode 100644
index 410078d8..00000000
--- a/src/plugins/sensors/simulator/qsensordata_simulator_p.h
+++ /dev/null
@@ -1,128 +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 QSENSORDATA_SIMULATOR_P_H
-#define QSENSORDATA_SIMULATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QMetaType>
-#include <QtCore/QDateTime>
-
-namespace QtMobility {
-
-enum SimulatorLightLevel {
- Undefined = 0,
- Dark,
- Twilight,
- Light,
- Bright,
- Sunny
-};
-
-struct QAmbientLightReadingData
-{
- SimulatorLightLevel lightLevel;
- QDateTime timestamp;
-};
-
-struct QLightReadingData
-{
- double lux;
- QDateTime timestamp;
-};
-
-struct QAccelerometerReadingData
-{
- double x;
- double y;
- double z;
- QDateTime timestamp;
-};
-
-struct QMagnetometerReadingData
-{
- double x;
- double y;
- double z;
- double calibrationLevel;
- QDateTime timestamp;
-};
-
-struct QCompassReadingData
-{
- double azimuth;
- double calibrationLevel;
- QDateTime timestamp;
-};
-
-struct QProximityReadingData
-{
- bool close;
- QDateTime timestamp;
-};
-
-struct QIRProximityReadingData
-{
- double irProximity;
- QDateTime timestamp;
-};
-
-void qt_registerSensorTypes();
-
-}
-
-Q_DECLARE_METATYPE(QtMobility::QAmbientLightReadingData)
-Q_DECLARE_METATYPE(QtMobility::QLightReadingData)
-Q_DECLARE_METATYPE(QtMobility::QAccelerometerReadingData)
-Q_DECLARE_METATYPE(QtMobility::QMagnetometerReadingData)
-Q_DECLARE_METATYPE(QtMobility::QCompassReadingData)
-Q_DECLARE_METATYPE(QtMobility::QProximityReadingData)
-Q_DECLARE_METATYPE(QtMobility::QIRProximityReadingData)
-
-#endif // QSENSORDATA_SIMULATOR_P_H
diff --git a/src/plugins/sensors/simulator/simulator.pro b/src/plugins/sensors/simulator/simulator.pro
deleted file mode 100644
index ac8ea506..00000000
--- a/src/plugins/sensors/simulator/simulator.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-TARGET = qtsensors_simulator
-
-QT=core gui network sensors simulator
-
-HEADERS += \
- simulatorcommon.h\
- simulatoraccelerometer.h\
- simulatorambientlightsensor.h\
- simulatorlightsensor.h\
- simulatorcompass.h\
- simulatorproximitysensor.h\
- simulatorirproximitysensor.h\
- simulatormagnetometer.h\
- qsensordata_simulator_p.h
-
-SOURCES += \
- simulatorcommon.cpp\
- simulatoraccelerometer.cpp\
- simulatorambientlightsensor.cpp\
- simulatorlightsensor.cpp\
- simulatorcompass.cpp\
- simulatorproximitysensor.cpp\
- simulatorirproximitysensor.cpp\
- simulatormagnetometer.cpp\
- qsensordata_simulator.cpp\
- main.cpp
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = SimulatorSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp
deleted file mode 100644
index 280fc7ee..00000000
--- a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp
+++ /dev/null
@@ -1,71 +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 "simulatoraccelerometer.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorAccelerometer::id("Simulator.Accelerometer");
-
-SimulatorAccelerometer::SimulatorAccelerometer(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QAccelerometerReading>(&m_reading);
-}
-
-void SimulatorAccelerometer::poll()
-{
- QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch());
- if (m_reading.x() != data.x
- || m_reading.y() != data.y
- || m_reading.z() != data.z) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setX(data.x);
- m_reading.setY(data.y);
- m_reading.setZ(data.z);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.h b/src/plugins/sensors/simulator/simulatoraccelerometer.h
deleted file mode 100644
index a4205867..00000000
--- a/src/plugins/sensors/simulator/simulatoraccelerometer.h
+++ /dev/null
@@ -1,59 +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 SIMULATORACCELEROMETER_H
-#define SIMULATORACCELEROMETER_H
-
-#include "simulatorcommon.h"
-#include <qaccelerometer.h>
-
-class SimulatorAccelerometer : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorAccelerometer(QSensor *sensor);
-
- void poll() override;
-private:
- QAccelerometerReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp
deleted file mode 100644
index 5d84b36c..00000000
--- a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp
+++ /dev/null
@@ -1,89 +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 "simulatorambientlightsensor.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorAmbientLightSensor::id("Simulator.AmbientLightSensor");
-
-SimulatorAmbientLightSensor::SimulatorAmbientLightSensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QAmbientLightReading>(&m_reading);
-}
-
-void SimulatorAmbientLightSensor::poll()
-{
- QtMobility::QAmbientLightReadingData data = SensorsConnection::instance()->qtAmbientLightData;
- QAmbientLightReading::LightLevel convertedLightLevel;
- switch (data.lightLevel) {
- case QtMobility::Dark:
- convertedLightLevel = QAmbientLightReading::Dark;
- break;
- case QtMobility::Twilight:
- convertedLightLevel = QAmbientLightReading::Twilight;
- break;
- case QtMobility::Light:
- convertedLightLevel = QAmbientLightReading::Light;
- break;
- case QtMobility::Bright:
- convertedLightLevel = QAmbientLightReading::Bright;
- break;
- case QtMobility::Sunny:
- convertedLightLevel = QAmbientLightReading::Sunny;
- break;
- default:
- convertedLightLevel = QAmbientLightReading::Undefined;
- break;
- }
-
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch());
- if (m_reading.lightLevel() != convertedLightLevel) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setLightLevel(convertedLightLevel);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.h b/src/plugins/sensors/simulator/simulatorambientlightsensor.h
deleted file mode 100644
index 0aadffe6..00000000
--- a/src/plugins/sensors/simulator/simulatorambientlightsensor.h
+++ /dev/null
@@ -1,59 +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 SIMULATORAMBIENTLIGHTSENSOR_H
-#define SIMULATORAMBIENTLIGHTSENSOR_H
-
-#include "simulatorcommon.h"
-#include <qambientlightsensor.h>
-
-class SimulatorAmbientLightSensor : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorAmbientLightSensor(QSensor *sensor);
-
- void poll() override;
-private:
- QAmbientLightReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatorcommon.cpp b/src/plugins/sensors/simulator/simulatorcommon.cpp
deleted file mode 100644
index a1693364..00000000
--- a/src/plugins/sensors/simulator/simulatorcommon.cpp
+++ /dev/null
@@ -1,252 +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 "simulatorcommon.h"
-#include "qsensordata_simulator_p.h"
-#include <QtSimulator/QtSimulator>
-#include <QDebug>
-#include <QThread>
-
-using namespace Simulator;
-
-Q_GLOBAL_STATIC(SensorsConnection, sensorsConnection)
-
-class SimulatorAsyncConnection: public QThread
-{
- Q_OBJECT
-public:
- SimulatorAsyncConnection()
- : QThread()
- {
- QtMobility::qt_registerSensorTypes();
-
- moveToThread(this);
- connect(this, SIGNAL(queueConnectToServer()),
- this, SLOT(doConnectToServer()),
- Qt::QueuedConnection);
-
- start();
- }
-
- ~SimulatorAsyncConnection()
- {
- quit();
- wait();
- }
-
- void connectToServer()
- {
- emit queueConnectToServer();
- }
-
-signals:
- void queueConnectToServer();
-
- void initialSensorsDataSent();
- void connectionFailed();
- void setAvailableFeatures(quint32 features);
- void setAmbientLightData(const QtMobility::QAmbientLightReadingData &);
- void setLightData(const QtMobility::QLightReadingData &);
- void setAccelerometerData(const QtMobility::QAccelerometerReadingData &);
- void setMagnetometerData(const QtMobility::QMagnetometerReadingData &);
- void setCompassData(const QtMobility::QCompassReadingData &);
- void setProximityData(const QtMobility::QProximityReadingData &);
- void setIRProximityData(const QtMobility::QIRProximityReadingData &);
-
-private slots:
- void doConnectToServer()
- {
- mConnection.reset(new Connection(Connection::Client, "QtSimulator_Mobility_ServerName1.3.0.0",
- 0xbeef+1, Version(1,0,0,0), this));
- mWorker.reset(mConnection->connectToServer(Connection::simulatorHostName(true), 0xbeef+1));
- if (!mWorker) {
- qWarning("QtSensors simulator backend could not connect to the simulator!");
- emit connectionFailed();
- return;
- }
- mWorker->addReceiver(this);
- mWorker->call("setRequestsSensors");
- }
-
-private:
- QScopedPointer<Simulator::Connection> mConnection;
- QScopedPointer<Simulator::ConnectionWorker> mWorker;
-};
-
-SensorsConnection::SensorsConnection(QObject *parent)
- : QObject(parent)
- , mInitialDataSent(false)
- , mConnectionFailed(false)
-{
- mConnection = new SimulatorAsyncConnection();
-
- connect(mConnection, SIGNAL(initialSensorsDataSent()),
- this, SLOT(initialSensorsDataSent()));
- connect(mConnection, SIGNAL(connectionFailed()),
- this, SLOT(slotConnectionFailed()));
- connect(mConnection, SIGNAL(setAvailableFeatures(quint32)),
- this, SIGNAL(setAvailableFeatures(quint32)));
- connect(mConnection, SIGNAL(setAmbientLightData(QtMobility::QAmbientLightReadingData)),
- this, SLOT(setAmbientLightData(QtMobility::QAmbientLightReadingData)));
- connect(mConnection, SIGNAL(setLightData(QtMobility::QLightReadingData)),
- this, SLOT(setLightData(QtMobility::QLightReadingData)));
- connect(mConnection, SIGNAL(setAccelerometerData(QtMobility::QAccelerometerReadingData)),
- this, SLOT(setAccelerometerData(QtMobility::QAccelerometerReadingData)));
- connect(mConnection, SIGNAL(setMagnetometerData(QtMobility::QMagnetometerReadingData)),
- this, SLOT(setMagnetometerData(QtMobility::QMagnetometerReadingData)));
- connect(mConnection, SIGNAL(setCompassData(QtMobility::QCompassReadingData)),
- this, SLOT(setCompassData(QtMobility::QCompassReadingData)));
- connect(mConnection, SIGNAL(setProximityData(QtMobility::QProximityReadingData)),
- this, SLOT(setProximityData(QtMobility::QProximityReadingData)));
- connect(mConnection, SIGNAL(setIRProximityData(QtMobility::QIRProximityReadingData)),
- this, SLOT(setIRProximityData(QtMobility::QIRProximityReadingData)));
-
- mConnection->connectToServer();
-}
-
-SensorsConnection::~SensorsConnection()
-{
- delete mConnection;
-}
-
-SensorsConnection *SensorsConnection::instance()
-{
- SensorsConnection *connection = sensorsConnection();
- // It's safe to return 0 because this is checked when used
- //if (!connection) qFatal("Cannot return from SensorsConnection::instance because sensorsConnection() returned 0");
- return connection;
-}
-
-void SensorsConnection::setAmbientLightData(const QtMobility::QAmbientLightReadingData &data)
-{
- qtAmbientLightData = data;
-}
-
-void SensorsConnection::setLightData(const QtMobility::QLightReadingData &data)
-{
- qtLightData = data;
-}
-
-void SensorsConnection::setAccelerometerData(const QtMobility::QAccelerometerReadingData &data)
-{
- qtAccelerometerData = data;
-}
-
-void SensorsConnection::setMagnetometerData(const QtMobility::QMagnetometerReadingData &data)
-{
- qtMagnetometerData = data;
-}
-
-void SensorsConnection::setCompassData(const QtMobility::QCompassReadingData &data)
-{
- qtCompassData = data;
-}
-
-void SensorsConnection::setProximityData(const QtMobility::QProximityReadingData &data)
-{
- qtProximityData = data;
-}
-
-void SensorsConnection::setIRProximityData(const QtMobility::QIRProximityReadingData &data)
-{
- qtIRProximityData = data;
-}
-
-void SensorsConnection::initialSensorsDataSent()
-{
- mInitialDataSent = true;
-}
-
-void SensorsConnection::slotConnectionFailed()
-{
- mInitialDataSent = false;
- mConnectionFailed = true;
-}
-
-SimulatorCommon::SimulatorCommon(QSensor *sensor)
- : QSensorBackend(sensor)
- , m_timerid(0)
-{
- addDataRate(1, 100);
- sensor->setDataRate(20);
- (void)SensorsConnection::instance(); // Ensure this exists
-}
-
-void SimulatorCommon::start()
-{
- SensorsConnection *connection = SensorsConnection::instance();
- if (!connection) {
- sensorStopped();
- return;
- }
-
- if (m_timerid)
- return;
-
- int rate = sensor()->dataRate();
- if (rate == 0)
- rate = 20;
- int interval = 1000 / rate;
- if (interval < 0)
- interval = 1000;
-
- if (interval)
- m_timerid = startTimer(interval);
-}
-
-void SimulatorCommon::stop()
-{
- if (m_timerid) {
- killTimer(m_timerid);
- m_timerid = 0;
- }
-}
-
-void SimulatorCommon::timerEvent(QTimerEvent * /*event*/)
-{
- SensorsConnection *connection = SensorsConnection::instance();
- if (!connection || connection->connectionFailed()) {
- stop();
- sensorStopped();
- }
- if (!connection->safe()) return; // wait until it's safe to read the data
- poll();
-}
-
-#include "simulatorcommon.moc"
diff --git a/src/plugins/sensors/simulator/simulatorcommon.h b/src/plugins/sensors/simulator/simulatorcommon.h
deleted file mode 100644
index e47f24d0..00000000
--- a/src/plugins/sensors/simulator/simulatorcommon.h
+++ /dev/null
@@ -1,105 +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 SIMULATORCOMMON_H
-#define SIMULATORCOMMON_H
-
-#include <qsensorbackend.h>
-#include "qsensordata_simulator_p.h"
-
-class QTimer;
-
-class SimulatorAsyncConnection;
-
-class SensorsConnection : public QObject
-{
- Q_OBJECT
-public:
- explicit SensorsConnection(QObject *parent = 0);
- virtual ~SensorsConnection();
-
- static SensorsConnection *instance();
- bool safe() const { return mInitialDataSent; }
- bool connectionFailed() const { return mConnectionFailed; }
-
-signals:
- void setAvailableFeatures(quint32 features);
-
-public slots:
- void setAmbientLightData(const QtMobility::QAmbientLightReadingData &);
- void setLightData(const QtMobility::QLightReadingData &);
- void setAccelerometerData(const QtMobility::QAccelerometerReadingData &);
- void setMagnetometerData(const QtMobility::QMagnetometerReadingData &);
- void setCompassData(const QtMobility::QCompassReadingData &);
- void setProximityData(const QtMobility::QProximityReadingData &);
- void setIRProximityData(const QtMobility::QIRProximityReadingData &);
- void initialSensorsDataSent();
- void slotConnectionFailed();
-
-private:
- SimulatorAsyncConnection *mConnection;
- bool mInitialDataSent;
- bool mConnectionFailed;
-
-public:
- QtMobility::QAmbientLightReadingData qtAmbientLightData;
- QtMobility::QLightReadingData qtLightData;
- QtMobility::QAccelerometerReadingData qtAccelerometerData;
- QtMobility::QMagnetometerReadingData qtMagnetometerData;
- QtMobility::QCompassReadingData qtCompassData;
- QtMobility::QProximityReadingData qtProximityData;
- QtMobility::QIRProximityReadingData qtIRProximityData;
-};
-
-class SimulatorCommon : public QSensorBackend
-{
-public:
- SimulatorCommon(QSensor *sensor);
-
- void start() override;
- void stop() override;
- virtual void poll() = 0;
- void timerEvent(QTimerEvent * /*event*/) override;
-
-private:
- int m_timerid;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatorcompass.cpp b/src/plugins/sensors/simulator/simulatorcompass.cpp
deleted file mode 100644
index e9d0f1d7..00000000
--- a/src/plugins/sensors/simulator/simulatorcompass.cpp
+++ /dev/null
@@ -1,69 +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 "simulatorcompass.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorCompass::id("Simulator.Compass");
-
-SimulatorCompass::SimulatorCompass(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QCompassReading>(&m_reading);
-}
-
-void SimulatorCompass::poll()
-{
- QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch());
- if (m_reading.azimuth() != data.azimuth
- || m_reading.calibrationLevel() != data.calibrationLevel) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setAzimuth(data.azimuth);
- m_reading.setCalibrationLevel(data.calibrationLevel);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatorcompass.h b/src/plugins/sensors/simulator/simulatorcompass.h
deleted file mode 100644
index 69162c69..00000000
--- a/src/plugins/sensors/simulator/simulatorcompass.h
+++ /dev/null
@@ -1,59 +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 SIMULATORCOMPASS_H
-#define SIMULATORCOMPASS_H
-
-#include "simulatorcommon.h"
-#include <qcompass.h>
-
-class SimulatorCompass : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorCompass(QSensor *sensor);
-
- void poll() override;
-private:
- QCompassReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp
deleted file mode 100644
index d041a86d..00000000
--- a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp
+++ /dev/null
@@ -1,67 +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 "simulatorirproximitysensor.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorIRProximitySensor::id("Simulator.IRProximitySensor");
-
-SimulatorIRProximitySensor::SimulatorIRProximitySensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QIRProximityReading>(&m_reading);
-}
-
-void SimulatorIRProximitySensor::poll()
-{
- QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch());
- if (m_reading.reflectance() != data.irProximity) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setReflectance(data.irProximity);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.h b/src/plugins/sensors/simulator/simulatorirproximitysensor.h
deleted file mode 100644
index db20968b..00000000
--- a/src/plugins/sensors/simulator/simulatorirproximitysensor.h
+++ /dev/null
@@ -1,59 +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 SIMULATORIRPROXIMITYSENSOR_H
-#define SIMULATORIRPROXIMITYSENSOR_H
-
-#include "simulatorcommon.h"
-#include <qirproximitysensor.h>
-
-class SimulatorIRProximitySensor : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorIRProximitySensor(QSensor *sensor);
-
- void poll() override;
-private:
- QIRProximityReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.cpp b/src/plugins/sensors/simulator/simulatorlightsensor.cpp
deleted file mode 100644
index bb4dd94d..00000000
--- a/src/plugins/sensors/simulator/simulatorlightsensor.cpp
+++ /dev/null
@@ -1,67 +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 "simulatorlightsensor.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorLightSensor::id("Simulator.LightSensor");
-
-SimulatorLightSensor::SimulatorLightSensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QLightReading>(&m_reading);
-}
-
-void SimulatorLightSensor::poll()
-{
- QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch());
- if (m_reading.lux() != data.lux) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setLux(data.lux);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.h b/src/plugins/sensors/simulator/simulatorlightsensor.h
deleted file mode 100644
index 3af3a526..00000000
--- a/src/plugins/sensors/simulator/simulatorlightsensor.h
+++ /dev/null
@@ -1,59 +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 SIMULATORLIGHTSENSOR_H
-#define SIMULATORLIGHTSENSOR_H
-
-#include "simulatorcommon.h"
-#include <qlightsensor.h>
-
-class SimulatorLightSensor : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorLightSensor(QSensor *sensor);
-
- void poll() override;
-private:
- QLightReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.cpp b/src/plugins/sensors/simulator/simulatormagnetometer.cpp
deleted file mode 100644
index b54525ab..00000000
--- a/src/plugins/sensors/simulator/simulatormagnetometer.cpp
+++ /dev/null
@@ -1,73 +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 "simulatormagnetometer.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorMagnetometer::id("Simulator.Magnetometer");
-
-SimulatorMagnetometer::SimulatorMagnetometer(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QMagnetometerReading>(&m_reading);
-}
-
-void SimulatorMagnetometer::poll()
-{
- QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch());
- if (m_reading.x() != data.x
- || m_reading.y() != data.y
- || m_reading.z() != data.z
- || m_reading.calibrationLevel() != data.calibrationLevel) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setX(data.x);
- m_reading.setY(data.y);
- m_reading.setZ(data.z);
- m_reading.setCalibrationLevel(data.calibrationLevel);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.h b/src/plugins/sensors/simulator/simulatormagnetometer.h
deleted file mode 100644
index facbad41..00000000
--- a/src/plugins/sensors/simulator/simulatormagnetometer.h
+++ /dev/null
@@ -1,59 +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 SIMULATORMAGNETOMETER_H
-#define SIMULATORMAGNETOMETER_H
-
-#include "simulatorcommon.h"
-#include <qmagnetometer.h>
-
-class SimulatorMagnetometer : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorMagnetometer(QSensor *sensor);
-
- void poll() override;
-private:
- QMagnetometerReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp
deleted file mode 100644
index 6a28ce52..00000000
--- a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp
+++ /dev/null
@@ -1,67 +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 "simulatorproximitysensor.h"
-#include <QDebug>
-#include <QtGlobal>
-
-const char *SimulatorProximitySensor::id("Simulator.ProximitySensor");
-
-SimulatorProximitySensor::SimulatorProximitySensor(QSensor *sensor)
- : SimulatorCommon(sensor)
-{
- setReading<QProximityReading>(&m_reading);
-}
-
-void SimulatorProximitySensor::poll()
-{
- QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData;
- quint64 newTimestamp;
- if (!data.timestamp.isValid())
- newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch() / 1000;
- else
- newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch();
- if (m_reading.close() != data.close) {
- m_reading.setTimestamp(newTimestamp);
- m_reading.setClose(data.close);
-
- newReadingAvailable();
- }
-}
-
diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.h b/src/plugins/sensors/simulator/simulatorproximitysensor.h
deleted file mode 100644
index 16e6f6bb..00000000
--- a/src/plugins/sensors/simulator/simulatorproximitysensor.h
+++ /dev/null
@@ -1,59 +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 SIMULATORPROXIMITYSENSOR_H
-#define SIMULATORPROXIMITYSENSOR_H
-
-#include "simulatorcommon.h"
-#include <qproximitysensor.h>
-
-class SimulatorProximitySensor : public SimulatorCommon
-{
-public:
- static const char *id;
-
- SimulatorProximitySensor(QSensor *sensor);
-
- void poll() override;
-private:
- QProximityReading m_reading;
-};
-
-#endif
-
diff --git a/src/plugins/sensors/winrt/CMakeLists.txt b/src/plugins/sensors/winrt/CMakeLists.txt
new file mode 100644
index 00000000..78baef86
--- /dev/null
+++ b/src/plugins/sensors/winrt/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## WinRtSensorPlugin Plugin:
+#####################################################################
+
+qt_internal_add_plugin(WinRtSensorPlugin
+ OUTPUT_NAME qtsensors_winrt
+ PLUGIN_TYPE sensors
+ SOURCES
+ main.cpp
+ winrtaccelerometer.cpp winrtaccelerometer.h
+ winrtambientlightsensor.cpp winrtambientlightsensor.h
+ winrtcommon.cpp winrtcommon.h
+ winrtcompass.cpp winrtcompass.h
+ winrtgyroscope.cpp winrtgyroscope.h
+ winrtorientationsensor.cpp winrtorientationsensor.h
+ winrtrotationsensor.cpp winrtrotationsensor.h
+ LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Sensors
+)
+
+qt_internal_extend_target(WinRtSensorPlugin CONDITION MSVC
+ LIBRARIES
+ runtimeobject
+)
+
+#### Keys ignored in scope 1:.:.:winrt.pro:<TRUE>:
+# OTHER_FILES = "plugin.json"
diff --git a/src/plugins/sensors/winrt/main.cpp b/src/plugins/sensors/winrt/main.cpp
index ecf2a41b..04869082 100644
--- a/src/plugins/sensors/winrt/main.cpp
+++ b/src/plugins/sensors/winrt/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtaccelerometer.h"
#include "winrtcompass.h"
@@ -52,6 +16,7 @@
#include <QtSensors/QSensorBackendFactory>
#include <QtSensors/QSensorManager>
#include <QtSensors/QSensorPluginInterface>
+#include <wrl.h>
class WinRtSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorBackendFactory
{
@@ -59,14 +24,24 @@ class WinRtSensorPlugin : public QObject, public QSensorPluginInterface, public
Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
Q_INTERFACES(QSensorPluginInterface)
public:
+
+ ~WinRtSensorPlugin()
+ {
+ CoUninitialize();
+ }
+
void registerSensors() override
{
- QSensorManager::registerBackend(QAccelerometer::type, QByteArrayLiteral("WinRtAccelerometer"), this);
- QSensorManager::registerBackend(QCompass::type, QByteArrayLiteral("WinRtCompass"), this);
- QSensorManager::registerBackend(QGyroscope::type, QByteArrayLiteral("WinRtGyroscope"), this);
- QSensorManager::registerBackend(QRotationSensor::type, QByteArrayLiteral("WinRtRotationSensor"), this);
- QSensorManager::registerBackend(QAmbientLightSensor::type, QByteArrayLiteral("WinRtAmbientLightSensor"), this);
- QSensorManager::registerBackend(QOrientationSensor::type, QByteArrayLiteral("WinRtOrientationSensor"), this);
+ if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) {
+ qErrnoWarning("CoInitializeEx() failed.");
+ return;
+ }
+ QSensorManager::registerBackend(QAccelerometer::sensorType, QByteArrayLiteral("WinRtAccelerometer"), this);
+ QSensorManager::registerBackend(QCompass::sensorType, QByteArrayLiteral("WinRtCompass"), this);
+ QSensorManager::registerBackend(QGyroscope::sensorType, QByteArrayLiteral("WinRtGyroscope"), this);
+ QSensorManager::registerBackend(QRotationSensor::sensorType, QByteArrayLiteral("WinRtRotationSensor"), this);
+ QSensorManager::registerBackend(QAmbientLightSensor::sensorType, QByteArrayLiteral("WinRtAmbientLightSensor"), this);
+ QSensorManager::registerBackend(QOrientationSensor::sensorType, QByteArrayLiteral("WinRtOrientationSensor"), this);
}
QSensorBackend *createBackend(QSensor *sensor) override
diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro
deleted file mode 100644
index 21996fdd..00000000
--- a/src/plugins/sensors/winrt/winrt.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-TARGET = qtsensors_winrt
-QT = sensors core core_private
-
-HEADERS += \
- winrtaccelerometer.h \
- winrtambientlightsensor.h \
- winrtcommon.h \
- winrtcompass.h \
- winrtorientationsensor.h \
- winrtrotationsensor.h \
- winrtgyroscope.h
-
-SOURCES += \
- main.cpp \
- winrtaccelerometer.cpp \
- winrtambientlightsensor.cpp \
- winrtcommon.cpp \
- winrtcompass.cpp \
- winrtorientationsensor.cpp \
- winrtrotationsensor.cpp \
- winrtgyroscope.cpp
-
-OTHER_FILES = plugin.json
-
-PLUGIN_TYPE = sensors
-PLUGIN_CLASS_NAME = WinRtSensorPlugin
-load(qt_plugin)
diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.cpp b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
index 3570a47d..43a364c9 100644
--- a/src/plugins/sensors/winrt/winrtaccelerometer.cpp
+++ b/src/plugins/sensors/winrt/winrtaccelerometer.cpp
@@ -1,51 +1,15 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtaccelerometer.h"
#include "winrtcommon.h"
#include <QtSensors/QAccelerometerReading>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
#include <windows.devices.sensors.h>
+
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
@@ -119,28 +83,30 @@ WinRtAccelerometer::WinRtAccelerometer(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtAccelerometerPrivate(this))
{
Q_D(WinRtAccelerometer);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer);
- ComPtr<IAccelerometerStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize accelerometer factory."
+
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Accelerometer);
+ ComPtr<IAccelerometerStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize accelerometer factory."
<< qt_error_string(hr);
- return hr;
- }
+ sensorError(hr);
+ return;
+ }
+ hr = factory->GetDefault(&d->sensor);
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default accelerometer."
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default accelerometer."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default accelerometer was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -167,11 +133,10 @@ void WinRtAccelerometer::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<AccelerometerReadingHandler> callback =
- Callback<AccelerometerReadingHandler>(d, &WinRtAccelerometerPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ ComPtr<AccelerometerReadingHandler> callback =
+ Callback<AccelerometerReadingHandler>(d, &WinRtAccelerometerPrivate::readingChanged);
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -200,9 +165,7 @@ void WinRtAccelerometer::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtaccelerometer.h b/src/plugins/sensors/winrt/winrtaccelerometer.h
index dcb52ee5..96b0f093 100644
--- a/src/plugins/sensors/winrt/winrtaccelerometer.h
+++ b/src/plugins/sensors/winrt/winrtaccelerometer.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTACCELEROMETER_H
#define WINRTACCELEROMETER_H
diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
index 426d61bf..17785256 100644
--- a/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtambientlightsensor.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtambientlightsensor.h"
#include "winrtcommon.h"
#include <QtSensors/QAmbientLightSensor>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -118,27 +81,27 @@ WinRtAmbientLightSensor::WinRtAmbientLightSensor(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtAmbientLightSensorPrivate(this))
{
Q_D(WinRtAmbientLightSensor);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_LightSensor);
- ComPtr<ILightSensorStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
- << qt_error_string(hr);
- return hr;
- }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default light sensor."
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_LightSensor);
+ ComPtr<ILightSensorStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default light sensor."
+ << qt_error_string(hr);
+ sensorError(hr);
+ return;
+ }
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default lightsensor was not found on the system.";
+ return;
+ }
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
@@ -166,11 +129,10 @@ void WinRtAmbientLightSensor::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<LightSensorReadingHandler> callback =
+ ComPtr<LightSensorReadingHandler> callback =
Callback<LightSensorReadingHandler>(d, &WinRtAmbientLightSensorPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -199,9 +161,7 @@ void WinRtAmbientLightSensor::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtambientlightsensor.h b/src/plugins/sensors/winrt/winrtambientlightsensor.h
index e32db890..160d7474 100644
--- a/src/plugins/sensors/winrt/winrtambientlightsensor.h
+++ b/src/plugins/sensors/winrt/winrtambientlightsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTAMBIENTLIGHTSENSOR_H
#define WINRTAMBIENTLIGHTSENSOR_H
diff --git a/src/plugins/sensors/winrt/winrtcommon.cpp b/src/plugins/sensors/winrt/winrtcommon.cpp
index 3e5d1525..e655a672 100644
--- a/src/plugins/sensors/winrt/winrtcommon.cpp
+++ b/src/plugins/sensors/winrt/winrtcommon.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtcommon.h"
diff --git a/src/plugins/sensors/winrt/winrtcommon.h b/src/plugins/sensors/winrt/winrtcommon.h
index db3c8197..6f4c868c 100644
--- a/src/plugins/sensors/winrt/winrtcommon.h
+++ b/src/plugins/sensors/winrt/winrtcommon.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTCOMMON_H
#define WINRTCOMMON_H
diff --git a/src/plugins/sensors/winrt/winrtcompass.cpp b/src/plugins/sensors/winrt/winrtcompass.cpp
index 5ef730d0..a12f1dcd 100644
--- a/src/plugins/sensors/winrt/winrtcompass.cpp
+++ b/src/plugins/sensors/winrt/winrtcompass.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtcompass.h"
#include "winrtcommon.h"
#include <QtSensors/QCompass>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -136,28 +99,30 @@ WinRtCompass::WinRtCompass(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtCompassPrivate(this))
{
Q_D(WinRtCompass);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Compass);
- ComPtr<ICompassStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
+
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Compass);
+ ComPtr<ICompassStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize light sensor factory."
<< qt_error_string(hr);
- return hr;
- }
+ sensorError(hr);
+ return;
+ }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default compass."
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default compass."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default compass was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -183,12 +148,10 @@ void WinRtCompass::start()
return;
if (d->token.value)
return;
-
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<CompassReadingHandler> callback =
+ ComPtr<CompassReadingHandler> callback =
Callback<CompassReadingHandler>(d, &WinRtCompassPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -216,9 +179,8 @@ void WinRtCompass::stop()
return;
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtcompass.h b/src/plugins/sensors/winrt/winrtcompass.h
index 5bb8faf1..f4297c36 100644
--- a/src/plugins/sensors/winrt/winrtcompass.h
+++ b/src/plugins/sensors/winrt/winrtcompass.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTCOMPASS_H
#define WINRTCOMPASS_H
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.cpp b/src/plugins/sensors/winrt/winrtgyroscope.cpp
index 45b544c7..c5fff500 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.cpp
+++ b/src/plugins/sensors/winrt/winrtgyroscope.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtgyroscope.h"
#include "winrtcommon.h"
#include <QtSensors/QGyroscope>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -51,7 +14,7 @@ using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Devices::Sensors;
-typedef ITypedEventHandler<Gyrometer *, GyrometerReadingChangedEventArgs *> InclinometerReadingHandler;
+typedef ITypedEventHandler<Gyrometer *, GyrometerReadingChangedEventArgs *> GyrometerReadingHandler;
QT_USE_NAMESPACE
@@ -116,28 +79,30 @@ WinRtGyroscope::WinRtGyroscope(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtGyroscopePrivate(this))
{
Q_D(WinRtGyroscope);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Gyrometer);
- ComPtr<IGyrometerStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize gyroscope sensor factory."
+
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Gyrometer);
+ ComPtr<IGyrometerStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize gyroscope sensor factory."
<< qt_error_string(hr);
- return hr;
- }
+ sensorError(hr);
+ return;
+ }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor."
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default gyroscope sensor."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default gyroscope was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -164,11 +129,10 @@ void WinRtGyroscope::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<InclinometerReadingHandler> callback =
- Callback<InclinometerReadingHandler>(d, &WinRtGyroscopePrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ ComPtr<GyrometerReadingHandler> callback =
+ Callback<GyrometerReadingHandler>(d, &WinRtGyroscopePrivate::readingChanged);
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -197,9 +161,7 @@ void WinRtGyroscope::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.h b/src/plugins/sensors/winrt/winrtgyroscope.h
index 7bd85332..9d2fad4b 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.h
+++ b/src/plugins/sensors/winrt/winrtgyroscope.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTGYROSCOPE_H
#define WINRTGYROSCOPE_H
@@ -55,7 +19,7 @@ public:
bool isFeatureSupported(QSensor::Feature feature) const override
{
- if (feature == QSensor::AxesOrientation || feature == QSensor::AccelerationMode)
+ if (feature == QSensor::Feature::AxesOrientation || feature == QSensor::Feature::AccelerationMode)
return true;
return false;
}
diff --git a/src/plugins/sensors/winrt/winrtorientationsensor.cpp b/src/plugins/sensors/winrt/winrtorientationsensor.cpp
index e24ff954..330ccae7 100644
--- a/src/plugins/sensors/winrt/winrtorientationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtorientationsensor.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtorientationsensor.h"
#include "winrtcommon.h"
#include <QtSensors/QOrientationSensor>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -122,27 +85,26 @@ WinRtOrientationSensor::WinRtOrientationSensor(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtOrientationSensorPrivate(this))
{
Q_D(WinRtOrientationSensor);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_SimpleOrientationSensor);
- ComPtr<ISimpleOrientationSensorStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize orientation sensor factory."
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_SimpleOrientationSensor);
+ ComPtr<ISimpleOrientationSensorStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize orientation sensor factory."
<< qt_error_string(hr);
- return hr;
- }
-
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor."
+ sensorError(hr);
+ return;
+ }
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default orientation sensor."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default orientationsensor was not found on the system.";
+ return;
+ }
setReading<QOrientationReading>(&d->reading);
}
@@ -159,11 +121,10 @@ void WinRtOrientationSensor::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<SimpleOrientationReadingHandler> callback =
+ ComPtr<SimpleOrientationReadingHandler> callback =
Callback<SimpleOrientationReadingHandler>(d, &WinRtOrientationSensorPrivate::readingChanged);
- return d->sensor->add_OrientationChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_OrientationChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -180,9 +141,7 @@ void WinRtOrientationSensor::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_OrientationChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_OrientationChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtorientationsensor.h b/src/plugins/sensors/winrt/winrtorientationsensor.h
index 8e40a3e9..e7aaf4d8 100644
--- a/src/plugins/sensors/winrt/winrtorientationsensor.h
+++ b/src/plugins/sensors/winrt/winrtorientationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTORIENTATIONSENSOR_H
#define WINRTORIENTATIONSENSOR_H
diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.cpp b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
index 5dd4eae5..c29395fa 100644
--- a/src/plugins/sensors/winrt/winrtrotationsensor.cpp
+++ b/src/plugins/sensors/winrt/winrtrotationsensor.cpp
@@ -1,47 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "winrtrotationsensor.h"
#include "winrtcommon.h"
#include <QtSensors/QRotationSensor>
-#include <private/qeventdispatcher_winrt_p.h>
#include <functional>
#include <wrl.h>
@@ -114,28 +77,29 @@ WinRtRotationSensor::WinRtRotationSensor(QSensor *sensor)
: QSensorBackend(sensor), d_ptr(new WinRtRotationSensorPrivate(this))
{
Q_D(WinRtRotationSensor);
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Inclinometer);
- ComPtr<IInclinometerStatics> factory;
- HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to initialize rotation sensor factory."
- << qt_error_string(hr);
- return hr;
- }
- hr = factory->GetDefault(&d->sensor);
- if (FAILED(hr)) {
- qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor."
+ HStringReference classId(RuntimeClass_Windows_Devices_Sensors_Inclinometer);
+ ComPtr<IInclinometerStatics> factory;
+ HRESULT hr = RoGetActivationFactory(classId.Get(), IID_PPV_ARGS(&factory));
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to initialize rotation sensor factory."
+ << qt_error_string(hr);
+ sensorError(hr);
+ return;
+ }
+ hr = factory->GetDefault(&d->sensor);
+ if (FAILED(hr)) {
+ qCWarning(lcWinRtSensors) << "Unable to get default rotation sensor."
<< qt_error_string(hr);
- }
- return hr;
- });
- if (FAILED(hr) || !d->sensor) {
sensorError(hr);
return;
}
+ if (!d->sensor) {
+ qCWarning(lcWinRtSensors) << "Default rotationsensor was not found on the system.";
+ return;
+ }
+
hr = d->sensor->get_MinimumReportInterval(&d->minimumReportInterval);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to get the minimum report interval."
@@ -162,11 +126,10 @@ void WinRtRotationSensor::start()
if (d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- ComPtr<InclinometerReadingHandler> callback =
+ ComPtr<InclinometerReadingHandler> callback =
Callback<InclinometerReadingHandler>(d, &WinRtRotationSensorPrivate::readingChanged);
- return d->sensor->add_ReadingChanged(callback.Get(), &d->token);
- });
+ HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
+
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to attach to reading changed event."
<< qt_error_string(hr);
@@ -195,9 +158,7 @@ void WinRtRotationSensor::stop()
if (!d->token.value)
return;
- HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
- return d->sensor->remove_ReadingChanged(d->token);
- });
+ HRESULT hr = d->sensor->remove_ReadingChanged(d->token);
if (FAILED(hr)) {
qCWarning(lcWinRtSensors) << "Unable to detach from reading changed event."
<< qt_error_string(hr);
diff --git a/src/plugins/sensors/winrt/winrtrotationsensor.h b/src/plugins/sensors/winrt/winrtrotationsensor.h
index 4b3e6faf..add2d027 100644
--- a/src/plugins/sensors/winrt/winrtrotationsensor.h
+++ b/src/plugins/sensors/winrt/winrtrotationsensor.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef WINRTROTATIONSENSOR_H
#define WINRTROTATIONSENSOR_H
@@ -55,7 +19,7 @@ public:
bool isFeatureSupported(QSensor::Feature feature) const override
{
- if (feature == QSensor::AxesOrientation || feature == QSensor::AccelerationMode)
+ if (feature == QSensor::Feature::AxesOrientation || feature == QSensor::Feature::AccelerationMode)
return true;
return false;
}