diff options
Diffstat (limited to 'src/sensors/doc')
42 files changed, 569 insertions, 1420 deletions
diff --git a/src/sensors/doc/images/sensorgesture-cover.png b/src/sensors/doc/images/sensorgesture-cover.png Binary files differdeleted file mode 100644 index 7b4fbc5f..00000000 --- a/src/sensors/doc/images/sensorgesture-cover.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-doubletap.png b/src/sensors/doc/images/sensorgesture-doubletap.png Binary files differdeleted file mode 100644 index 6253d0f8..00000000 --- a/src/sensors/doc/images/sensorgesture-doubletap.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-facedown.png b/src/sensors/doc/images/sensorgesture-facedown.png Binary files differdeleted file mode 100644 index a85664f1..00000000 --- a/src/sensors/doc/images/sensorgesture-facedown.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-faceup.png b/src/sensors/doc/images/sensorgesture-faceup.png Binary files differdeleted file mode 100644 index c20ef089..00000000 --- a/src/sensors/doc/images/sensorgesture-faceup.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-flat.png b/src/sensors/doc/images/sensorgesture-flat.png Binary files differdeleted file mode 100644 index e8eafafb..00000000 --- a/src/sensors/doc/images/sensorgesture-flat.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-hover.png b/src/sensors/doc/images/sensorgesture-hover.png Binary files differdeleted file mode 100644 index fecf6b3a..00000000 --- a/src/sensors/doc/images/sensorgesture-hover.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-shake.png b/src/sensors/doc/images/sensorgesture-shake.png Binary files differdeleted file mode 100644 index 06f9eeaf..00000000 --- a/src/sensors/doc/images/sensorgesture-shake.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-slam_1.png b/src/sensors/doc/images/sensorgesture-slam_1.png Binary files differdeleted file mode 100644 index d56f8892..00000000 --- a/src/sensors/doc/images/sensorgesture-slam_1.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-slam_2.png b/src/sensors/doc/images/sensorgesture-slam_2.png Binary files differdeleted file mode 100644 index 5fe8ecba..00000000 --- a/src/sensors/doc/images/sensorgesture-slam_2.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-twist.png b/src/sensors/doc/images/sensorgesture-twist.png Binary files differdeleted file mode 100644 index bec15854..00000000 --- a/src/sensors/doc/images/sensorgesture-twist.png +++ /dev/null diff --git a/src/sensors/doc/images/sensorgesture-whip.png b/src/sensors/doc/images/sensorgesture-whip.png Binary files differdeleted file mode 100644 index aa998bb7..00000000 --- a/src/sensors/doc/images/sensorgesture-whip.png +++ /dev/null diff --git a/src/sensors/doc/qtsensors-module-use.qdocinc b/src/sensors/doc/qtsensors-module-use.qdocinc new file mode 100644 index 00000000..761b6bbd --- /dev/null +++ b/src/sensors/doc/qtsensors-module-use.qdocinc @@ -0,0 +1,15 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +//! [cmakebuild] + \code + find_package(Qt6 REQUIRED COMPONENTS Sensors) + target_link_libraries(mytarget PRIVATE Qt6::Sensors) + \endcode +//! [cmakebuild] + +//! [qmakebuild] + \code + QT += sensors + \endcode +//! [qmakebuild] diff --git a/src/sensors/doc/qtsensors.qdocconf b/src/sensors/doc/qtsensors.qdocconf index 0845e707..b7569927 100644 --- a/src/sensors/doc/qtsensors.qdocconf +++ b/src/sensors/doc/qtsensors.qdocconf @@ -1,4 +1,3 @@ -include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) include($QT_INSTALL_DOCS/config/exampleurl-qtsensors.qdocconf) @@ -14,33 +13,26 @@ qhp.QtSensors.virtualFolder = qtsensors qhp.QtSensors.indexTitle = Qt Sensors qhp.QtSensors.indexRoot = -qhp.QtSensors.filterAttributes = qtsensors $QT_VERSION qtrefdoc -qhp.QtSensors.customFilters.Qt.name = QtSensors $QT_VERSION -qhp.QtSensors.customFilters.Qt.filterAttributes = qtsensors $QT_VERSION qhp.QtSensors.subprojects = overviews classes qmltypes examples qhp.QtSensors.subprojects.overviews.title = Overview qhp.QtSensors.subprojects.overviews.indexTitle = Qt Sensors -qhp.QtSensors.subprojects.overviews.selectors = fake:page,group,module +qhp.QtSensors.subprojects.overviews.selectors = doc:page,group,module qhp.QtSensors.subprojects.classes.title = C++ Classes qhp.QtSensors.subprojects.classes.indexTitle = Qt Sensors C++ Classes -qhp.QtSensors.subprojects.classes.selectors = class fake:headerfile +qhp.QtSensors.subprojects.classes.selectors = class headerfile qhp.QtSensors.subprojects.classes.sortPages = true qhp.QtSensors.subprojects.qmltypes.title = QML Types qhp.QtSensors.subprojects.qmltypes.indexTitle = Qt Sensors QML Types -qhp.QtSensors.subprojects.qmltypes.selectors = qmlclass +qhp.QtSensors.subprojects.qmltypes.selectors = qmltype qhp.QtSensors.subprojects.qmltypes.sortPages = true qhp.QtSensors.subprojects.examples.title = Examples qhp.QtSensors.subprojects.examples.indexTitle = Qt Sensors Examples -qhp.QtSensors.subprojects.examples.selectors = fake:example +qhp.QtSensors.subprojects.examples.selectors = doc:example tagfile = ../../../doc/qtsensors/qtsensors.tags -headerdirs += .. \ - ../../imports/sensors \ - ../../plugins/sensors - -sourcedirs += .. \ - ../../imports/sensors \ +{headerdirs,sourcedirs} += .. \ + ../../sensorsquick \ ../../plugins/sensors exampledirs += ../../../examples/sensors \ @@ -51,7 +43,10 @@ examplesinstallpath = sensors imagedirs += images -depends += qtcore qtdoc qtgui +depends += qtcore qtdoc qtgui qtquick qtcmake + +# Highlighted examples +manifestmeta.highlighted.names = "QtSensors/Sensors Showcase" navigation.landingpage = "Qt Sensors" navigation.cppclassespage = "Qt Sensors C++ Classes" diff --git a/src/sensors/doc/snippets/sensorgestures/creating.cpp b/src/sensors/doc/snippets/sensorgestures/creating.cpp deleted file mode 100644 index 78f7a737..00000000 --- a/src/sensors/doc/snippets/sensorgestures/creating.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** 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 <QObject> -#include <QString> -#include <QSensorGestureManager> - -class MyObject : public QObject -{ - void create(); -public slots: - void gestureDetected(const QString &); -}; - -void MyObject::create() -{ -//! [Receiving sensor gesture signals] - -// Create a QSensorGestureManager - QSensorGestureManager gestureManager; - -// Get a list of known recognizers - QStringList recognizersList = gestureManager.gestureIds(); - -// Create a QSensorGeture object for each of those gesture recognizers - QSensorGesture *gesture = new QSensorGesture( gestureManager.gestureIds(), this); -// Connect the known signals up. - connect(gesture, SIGNAL(detected(QString)), this, SLOT(gestureDetected(QString))); -//! [Receiving sensor gesture signals] -} - -void MyObject::gestureDetected(const QString &gesture) -{ - Q_UNUSED(gesture); -} - diff --git a/src/sensors/doc/snippets/sensorgestures/main.cpp b/src/sensors/doc/snippets/sensorgestures/main.cpp deleted file mode 100644 index dee1ecb6..00000000 --- a/src/sensors/doc/snippets/sensorgestures/main.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -int main(int /*argc*/, char ** /*argv*/) -{ - return 0; -} - diff --git a/src/sensors/doc/snippets/sensorgestures/myplugin.h b/src/sensors/doc/snippets/sensorgestures/myplugin.h deleted file mode 100644 index 0cf1a92b..00000000 --- a/src/sensors/doc/snippets/sensorgestures/myplugin.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** 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 MYPLUGIN_H -#define MYPLUGIN_H - -#include <QObject> -#include <qsensorgestureplugininterface.h> -#include <qsensorgesturerecognizer.h> - -class MySensorGestureRecognizer : public QSensorGestureRecognizer -{ - Q_OBJECT - public: - - MySensorGestureRecognizer(QObject *parent = 0); - ~MySensorGestureRecognizer(); - - void create() override; - - QString id() const override; - bool start() override; - bool stop() override; - bool isActive() override; - -Q_SIGNALS: -// all signals will get exported to QSensorGesture - void mySignal(); -}; - -class MySensorGesturePlugin : public QObject, public QSensorGesturePluginInterface -{ - Q_OBJECT - //Q_PLUGIN_METADATA(IID "com.Nokia.QSensorGesturePluginInterface" FILE "plugin.json") - Q_INTERFACES(QSensorGesturePluginInterface) -public: - - explicit MySensorGesturePlugin(); - ~MySensorGesturePlugin(); - - QList<QSensorGestureRecognizer *> createRecognizers() override; - QStringList supportedIds() const override; - QString name() const override { return "MyGestures"; } -}; - -#endif diff --git a/src/sensors/doc/snippets/sensorgestures/plugin.cpp b/src/sensors/doc/snippets/sensorgestures/plugin.cpp deleted file mode 100644 index a94a188e..00000000 --- a/src/sensors/doc/snippets/sensorgestures/plugin.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** 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 "myplugin.h" - -#include <qsensorgestureplugininterface.h> -#include <qsensorgesturemanager.h> - -//! [Plugin] - -MySensorGestureRecognizer::MySensorGestureRecognizer(QObject *parent) - : QSensorGestureRecognizer(parent) -{ -} - -MySensorGestureRecognizer::~MySensorGestureRecognizer() -{ -} - -bool MySensorGestureRecognizer::start() -{ - Q_EMIT mySignal(); - return true; -} - -bool MySensorGestureRecognizer::stop() -{ - return true; -} - -bool MySensorGestureRecognizer::isActive() -{ - return true; -} - -void MySensorGestureRecognizer::create() -{ -} - -QString MySensorGestureRecognizer::id() const -{ - return QString("QtSensors.mygestures"); -} - - -MySensorGesturePlugin::MySensorGesturePlugin(){} -MySensorGesturePlugin::~MySensorGesturePlugin(){} - -QList <QSensorGestureRecognizer *> MySensorGesturePlugin::createRecognizers() -{ - QList <QSensorGestureRecognizer *> recognizers; - MySensorGestureRecognizer *recognizer = new MySensorGestureRecognizer(this); - recognizers.append(recognizer); - - return recognizers; -} - -QStringList MySensorGesturePlugin::supportedIds() const -{ - return QStringList() << "QtSensors.mygestures"; -} - -//! [Plugin] diff --git a/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro b/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro deleted file mode 100644 index 7442dd87..00000000 --- a/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE=app -TARGET=sensorgesturessdocsnippet -QT = core sensors -SOURCES+=main.cpp\ - creating.cpp\ - plugin.cpp -HEADERS+=myplugin.h -!win32:*g++*:LIBS+=-rdynamic diff --git a/src/sensors/doc/snippets/sensors/CMakeLists.txt b/src/sensors/doc/snippets/sensors/CMakeLists.txt new file mode 100644 index 00000000..27480020 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(sensorsdocsnippet LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(sensorsdocsnippet + creating.cpp + main.cpp + mybackend.h + plugin.cpp + start.cpp +) + +target_link_libraries(sensorsdocsnippet PUBLIC + Qt::Sensors +) + +if (GCC AND UNIX) + target_link_libraries(sensorsdocsnippet PUBLIC + rdynamic + log + ) +endif() diff --git a/src/sensors/doc/snippets/sensors/creating.cpp b/src/sensors/doc/snippets/sensors/creating.cpp index 4a5ef06d..4c99066f 100644 --- a/src/sensors/doc/snippets/sensors/creating.cpp +++ b/src/sensors/doc/snippets/sensors/creating.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 BSD-3-Clause #include <QObject> #include <qaccelerometer.h> @@ -57,7 +21,7 @@ QAccelerometer *sensor = new QAccelerometer(this); QOrientationSensor orient_sensor; //! [Creating a sensor] - Q_UNUSED(sensor) + Q_UNUSED(sensor); Q_UNUSED(orient_sensor); { @@ -69,7 +33,7 @@ Q_UNUSED(magnetometer); { //! [3] -QSensor *magnetometer = new QSensor(QMagnetometer::type, this); +QSensor *magnetometer = new QSensor(QMagnetometer::sensorType, this); //! [3] Q_UNUSED(magnetometer); } diff --git a/src/sensors/doc/snippets/sensors/main.cpp b/src/sensors/doc/snippets/sensors/main.cpp index dee1ecb6..fb6724d5 100644 --- a/src/sensors/doc/snippets/sensors/main.cpp +++ b/src/sensors/doc/snippets/sensors/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 BSD-3-Clause int main(int /*argc*/, char ** /*argv*/) { diff --git a/src/sensors/doc/snippets/sensors/mybackend.h b/src/sensors/doc/snippets/sensors/mybackend.h index 59c54069..b964e747 100644 --- a/src/sensors/doc/snippets/sensors/mybackend.h +++ b/src/sensors/doc/snippets/sensors/mybackend.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 BSD-3-Clause #ifndef MYBACKEND_H #define MYBACKEND_H diff --git a/src/sensors/doc/snippets/sensors/plugin.cpp b/src/sensors/doc/snippets/sensors/plugin.cpp index 1eef5966..27f50d72 100644 --- a/src/sensors/doc/snippets/sensors/plugin.cpp +++ b/src/sensors/doc/snippets/sensors/plugin.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 BSD-3-Clause #include "mybackend.h" #include <qsensorplugin.h> @@ -52,7 +16,7 @@ class MyPluginClass : public QObject, public QSensorPluginInterface, public QSen public: void registerSensors() override { - QSensorManager::registerBackend(QAccelerometer::type, MyBackend::id, this); + QSensorManager::registerBackend(QAccelerometer::sensorType, MyBackend::id, this); } QSensorBackend *createBackend(QSensor *sensor) override diff --git a/src/sensors/doc/snippets/sensors/sensors.pro b/src/sensors/doc/snippets/sensors/sensors.pro deleted file mode 100644 index 91d49772..00000000 --- a/src/sensors/doc/snippets/sensors/sensors.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE=app -TARGET=sensorsdocsnippet -QT = core sensors -SOURCES+=main.cpp\ - creating.cpp\ - start.cpp\ - plugin.cpp -HEADERS+=mybackend.h -!win32:*g++*:LIBS+=-rdynamic -OTHER_FILES += *.qml diff --git a/src/sensors/doc/snippets/sensors/start.cpp b/src/sensors/doc/snippets/sensors/start.cpp index 3ac5b50e..18c87d06 100644 --- a/src/sensors/doc/snippets/sensors/start.cpp +++ b/src/sensors/doc/snippets/sensors/start.cpp @@ -1,43 +1,9 @@ -/**************************************************************************** -** -** 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 BSD-3-Clause -#include <qsensor.h> +#include <QtSensors/qsensor.h> +#include <QtCore/QMetaObject> +#include <QtCore/QMetaproperty> void start() { @@ -52,6 +18,42 @@ qreal x = reading->property("x").value<qreal>(); qreal y = reading->value(1).value<qreal>(); //! [Starting a sensor] - Q_UNUSED(x) - Q_UNUSED(y) + Q_UNUSED(x); + Q_UNUSED(y); } + +class MyObject : public QObject +{ + void findSensors() + { + //! [Find sensors] + QList<QSensor*> mySensorList; + for (const QByteArray &type : QSensor::sensorTypes()) { + qDebug() << "Found a sensor type:" << type; + for (const QByteArray &identifier : QSensor::sensorsForType(type)) { + qDebug() << " " << "Found a sensor of that type:" << identifier; + QSensor* sensor = new QSensor(type, this); + sensor->setIdentifier(identifier); + mySensorList.append(sensor); + } + } + //! [Find sensors] + //! [Print reading properties] + for (QSensor* sensor : mySensorList) { + const int firstProperty = QSensorReading::staticMetaObject.propertyOffset(); + // Connect to backend first in case start() hasn't been called yet + if (!sensor->connectToBackend()) + continue; + qDebug() << "Sensor" << sensor->identifier() << "reading properties:"; + QSensorReading *reading = sensor->reading(); + if (reading) { + const QMetaObject *mo = reading->metaObject(); + for (int i = firstProperty; i < mo->propertyCount(); ++i) { + QByteArray name = mo->property(i).name(); + qDebug() << " " << name << reading->property(name).toByteArray(); + } + } + } + //! [Print reading properties] + } +}; diff --git a/src/sensors/doc/snippets/sensors/tutorial.cpp b/src/sensors/doc/snippets/sensors/tutorial.cpp new file mode 100644 index 00000000..e8714961 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/tutorial.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +//! [MySensor] +class MyReadingPrivate; + +class MyReading : public QSensorReading + { + Q_OBJECT + Q_PROPERTY(qreal myprop READ myprop) + DECLARE_READING(MyReading) +public: + qreal myprop() const; + void setMyprop(qreal myprop); + }; + +class MySensor : public QSensor +{ + Q_OBJECT +public: + explicit MySensor(QObject *parent = 0); + MyReading *reading() const; + static char const * const sensorType; + }; +//! [MySensor] diff --git a/src/sensors/doc/snippets/snippets.pro b/src/sensors/doc/snippets/snippets.pro deleted file mode 100644 index f73d4a35..00000000 --- a/src/sensors/doc/snippets/snippets.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += sensors -SUBDIRS += sensorgestures - diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc index 6db9f708..41f91a73 100644 --- a/src/sensors/doc/src/compatmap.qdoc +++ b/src/sensors/doc/src/compatmap.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Research In Motion -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page compatmap.html @@ -40,11 +16,11 @@ </tr> <tr> <td bgcolor="green"></td> - <td>The feature is fully supported.</td> + <td>The sensor is supported.</td> </tr> <tr> <td bgcolor="gray"></td> - <td>The feature is not supported.</td> + <td>The sensor is not supported.</td> </tr> </tbody> </table> @@ -56,29 +32,15 @@ <td><b>Android</b></td> <td><b>Linux</b></td> <td><b>iOS</b></td> - <td><b>Universal Windows Platform</b></td> + <td><b>Windows</b></td> <td><b>Generic</b></td> - <td><b>Sensorfw</b></td> - <td><b>TI Sensor Tag</b></td> </tr> <tr> <td nowrap="nowrap">Accelerometer</td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - </tr> - <tr> - <td nowrap="nowrap">Altimeter</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> <td bgcolor="gray"></td> </tr> <tr> @@ -88,8 +50,6 @@ <td bgcolor="gray"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Ambient Temperature Sensor</td> @@ -98,8 +58,6 @@ <td bgcolor="gray"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Compass</td> @@ -108,18 +66,6 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Distance</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Gyroscope</td> @@ -128,48 +74,6 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> - </tr> - <tr> - <td nowrap="nowrap">Holster Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Humidity Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - </tr> - <tr> - <td nowrap="nowrap">IR Proximity Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Lid Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Light Sensor</td> @@ -178,8 +82,6 @@ <td bgcolor="gray"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Magnetometer</td> @@ -188,8 +90,6 @@ <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Orientation Sensor</td> @@ -198,18 +98,14 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Pressure Sensor</td> <td bgcolor="green"></td> <td bgcolor="gray"></td> + <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> </tr> <tr> <td nowrap="nowrap">Proximity Sensor</td> @@ -218,8 +114,6 @@ <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Rotation Sensor</td> @@ -228,18 +122,6 @@ <td bgcolor="green"></td> <td bgcolor="green"></td> <td bgcolor="green"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Tap Sensor</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> </tr> <tr> <td nowrap="nowrap">Tilt Sensor</td> @@ -248,30 +130,149 @@ <td bgcolor="green"></td> <td bgcolor="gray"></td> <td bgcolor="green"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - </tr> - <tr> - <td nowrap="nowrap">Sensor Gestures</td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="gray"></td> - <td bgcolor="green"></td> - <td bgcolor="gray"></td> </tr> + </tbody> </table> \endraw - 1) Support depends on the underlying platform + \raw DocBook +<db:informaltable cellpadding="2" cellspacing="1" border="1" width="90%"> + <db:tbody> + <db:tr> + <db:td>Color</db:td> + <db:td>Explanation</db:td> + </db:tr> + <db:tr> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td>The sensor is supported.</db:td> + </db:tr> + <db:tr> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td>The sensor is not supported.</db:td> + </db:tr> + </db:tbody> + </db:informaltable> + + + <db:informaltable cellpadding="2" cellspacing="1" border="1" rules="all" width="90%"> + <db:tbody> + <db:tr> + <db:td><db:emphasis role="bold">Feature</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Android</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Linux</db:emphasis></db:td> + <db:td><db:emphasis role="bold">iOS</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Windows</db:emphasis></db:td> + <db:td><db:emphasis role="bold">Generic</db:emphasis></db:td> + </db:tr> + <db:tr> + <db:td>Accelerometer</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Ambient Light Sensor</db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + <db:tr> + <db:td>Ambient Temperature Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Compass</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Gyroscope</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Light Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Magnetometer</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Orientation Sensor</db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + <db:tr> + <db:td>Pressure Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Proximity Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + </db:tr> + <db:tr> + <db:td>Rotation Sensor</db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + <db:tr> + <db:td>Tilt Sensor</db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td> + <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td> + </db:tr> + </db:tbody> + </db:informaltable> + \endraw In addition to the table above, each sensor type might support specific features. For example, a magnetometer might support returning geo values. See QSensor::isFeatureSupported() for additional details. - Sensor Gestures are mostly platform independent, and will run if the platform has the sensors required. - Whether they are supported and work well or not depends on the platform. -*/ + \section1 Platform specific notes + \section2 Windows + + The Windows backend is supported in Qt installations that were built with MSVC. + +*/ diff --git a/src/sensors/doc/src/genericbackend.qdoc b/src/sensors/doc/src/genericbackend.qdoc index 001fce77..2c314e6d 100644 --- a/src/sensors/doc/src/genericbackend.qdoc +++ b/src/sensors/doc/src/genericbackend.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Research In Motion -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Research In Motion +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page genericbackend.html diff --git a/src/sensors/doc/src/porting.qdoc b/src/sensors/doc/src/porting.qdoc deleted file mode 100644 index 6f5d7ea4..00000000 --- a/src/sensors/doc/src/porting.qdoc +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtsensors-porting.html - \title Porting Applications from QtMobility Sensors to Qt Sensors - \brief Explain how to port from QtMobility Sensors to Qt Sensors - \since Qt 5.1 - - \tableofcontents - - \section1 Overview - - The initial release of Qt Sensors (5.0) is generally expected to be source - compatible with QtMobility Sensors 1.2. This document attempts to explain - where things need to be changed in order to port applications to Qt Sensors. - - \section1 QML - - In \c QtMobility, the C++ classes like \c QAccelerometer were directly used as QML types. - In Qt Sensors, there are now separate classes for the QML types, which have no public - C++ API. - - The new QML types in Qt Sensors fix some issues the former QtMobility QML types had, - for example: - \list - \li The reading types now have proper change notifications. - \li \c availableDataRates and \c outputRanges of the \c Sensor type are now proper list types. - \li The \c identifier and \c type properties of \c Sensor can now be used. - \li The \c lux property of \c LightSensorReading has been renamed to \c illuminance. - \li The \c QmlSensors singleton now allows to query for sensor types. - \endlist - - For more information, see the \l {Qt Sensors QML Types}{QML API} documentation. - - \section1 C++ - - The C++ API mainly remained the same as in QtMobility. - - \section2 Includes - - QtMobility Sensors installed headers into a \c Qt Sensors directory. This is - also the directory that Qt Sensors uses. It is therefore expected that includes - that worked with QtMobility Sensors should continue to work. - - For example: - \code - #include <QAccelerometer> - #include <qaccelerometer.h> - #include <QtSensors/QAccelerometer> - #include <QtSensors/qaccelerometer.h> - \endcode - - \section2 Macros and Namespace - - QtMobility Sensors was built in a \c QtMobility namespace. This was enabled by - the use of various macros. Qt Sensors does not normally build into a namespace - and the macros from QtMobility no longer exist. - - \list - \li QTM_BEGIN_NAMESPACE - \li QTM_END_NAMESPACE - \li QTM_USE_NAMESPACE - \li QTM_PREPEND_NAMESPACE(x) - \endlist - - Note that Qt can be configured to build into a namespace. If Qt is built in this - way then Qt Sensors is also built into the nominated namespace. However, as this - is optional, the macros for this are typically defined to do nothing. - - \list - \li QT_BEGIN_NAMESPACE - \li QT_END_NAMESPACE - \li QT_USE_NAMESPACE - \li QT_PREPEND_NAMESPACE(x) - \endlist - - \section2 qtimestamp - - qtimestamp was previously defined as an opaque type equivalent to a quint64. It existed - as a class due to an implementation detail. - - In Qt Sensors, the API uses quint64 instead of qtimestamp. qtimestamp still exists as a - typedef so that applications that refer to qtimestamp can be compiled. - - \section1 Project Files - - QtMobility Sensors applications used this in their project files to enable the Sensors API. - - \code - CONFIG += mobility - MOBILITY += sensors - \endcode - - Applications should remove these lines and instead use the following statement to enable - the Qt Sensors API: - - \code - QT += sensors - \endcode -*/ - diff --git a/src/sensors/doc/src/qt6-changes.qdoc b/src/sensors/doc/src/qt6-changes.qdoc new file mode 100644 index 00000000..de4f682b --- /dev/null +++ b/src/sensors/doc/src/qt6-changes.qdoc @@ -0,0 +1,94 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page qtsensors-changes-qt6.html + \title Changes to Qt Sensors + \ingroup changes-qt-5-to-6 + \brief Migrate Qt Sensors to Qt 6. + + Qt 6 is a result of the conscious effort to make the framework more + efficient and easy to use. + + We try to maintain binary and source compatibility for all the public + APIs in each release. But some changes were inevitable in an effort to + make Qt a better framework. + + In this topic we summarize those changes in Qt Sensors, and provide + guidance to handle them. + + \section1 Sensor Gesture support + + The Gesture support has been removed. In its current shape the gestures + needs rethinking to be of more use for the developers. To track this please + see \l {https://bugreports.qt.io/browse/QTBUG-95649}{QTBUG-95649}. + + \section1 Platform notes + + \section2 Windows + + On Windows, sensors are supported in Qt installations that were built with MSVC. + + \section2 sensorfw + + The \l {https://git.sailfishos.org/mer-core/sensorfw}{sensorfw} does not yet have + a Qt 6 port and is therefore not yet supported by sensors in Qt 6. + + \section2 TI Sensor Tag + + Support for TI Sensor Tag has been removed. + + \section2 Removed sensors + + QAltimeter, QDistanceSensor, QHolsterSensor and their QML counterparts + did no longer have a backend implementation and have been removed. + + QIRProximitySensor, QLidSensor, and QTapSensor have only sensorfw + backend, and as such they are not currently listed as supported sensor + types. + + \section2 Linux + + The Linux sysfs accelerometer support has been removed. The backend is + undocumented and has been without any real activity for almost 10 years. + + \section1 API changes + + \section2 Deleted typedef for qtimestamp + + The typedef for the historical, QtMobility-era, \c qtimestamp has been + removed. Use the actual type \c quint64 directly. + + \section2 Renamed \c sensor type string to \c sensorType + + The subclasses of QSensor implement a \c {char const*} string which defines + the string that identifies the base sensor. This static \c type field + shadowed the baseclass \l QSensor::type() method, leading to unnecessary + compilation errors and consequent workarounds. The \c type string has been + now renamed as \c sensorType. + + \section2 Renamed LidReading::backLidChanged property to \c backLidClosed + + The property name is now aligned with the \c frontLidClosed property of + the same QML type. + + \section2 Added parameter to QSensorBackend::sensorBusy() to be able to also clear + the busy state + + The \c QSensor::busy property and its accessor, \c QSensor::isBusy(), can be used + to check if the sensor is busy or not. To allow this property to better reflect the + sensor backend's state, QSensorBackend::sensorBusy() now accepts a boolean parameter. + This \c busy parameter is used to set/unset the backend busy state and notify the + QSensor interface attached to it. + + The default value for the QSensorBackend::sensorBusy() parameter is \e true which + results in the original behavior (except the added signal emission). This means + that in most if not all cases the changes are not mandatory. Instead it is up to the + individual sensor backend implementations to decide if the changes are useful. + + \section2 Sensor::type and and QSensor::type properties marked as constant + + The \c type property cannot change after instantiation and is marked as constant + in both C++ and QML. + +*/ diff --git a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc b/src/sensors/doc/src/qtsensorgestures-cpp.qdoc deleted file mode 100644 index 164ffafb..00000000 --- a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page qtsensorgestures-cpp.html -\title Sensor Gestures C++ Overview -\brief Explains how to use the QtSensorGestures C++ API - -\tableofcontents - -\section1 Using QtSensorGestures - -With the Sensor Gestures classes, you are able to easily utilize device gesturing using -sensors, such as the accelerometer and proximity. - -A list of currently supported sensor gestures and their descriptions can be found here: -\l {Qt Sensor Gestures} - -Using \c QtSensorGestures is easy. There are two main classes you will need to use: - -\list - \li QSensorGestureManager: can be used for determining which sensor gestures are available. - \li QSensorGesture : for connecting the sensor gesture signals. -\endlist - -\snippet sensorgestures/creating.cpp Receiving sensor gesture signals - -More information about the sensor gesture recognizers can be found in -\l{QtSensorGestures Plugins}. - -\section1 Main Classes - -The primary classes that make up the QtSensorGestures API: - -\annotatedlist sensorgestures_main - -The primary classes that make up the \c QtSensorGesturesRecognizers API: - -\annotatedlist sensorgestures_recognizer - -Details of the \c QSensorGesturePlugins available - -\annotatedlist sensorgesture_plugins_topics - -*/ - diff --git a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc b/src/sensors/doc/src/qtsensorgestures-emulator.qdoc deleted file mode 100644 index 0c8bc659..00000000 --- a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! -\group sensorgesture_emulator_topics -\title QtSensorGestures Emulator -\brief Explains how to develop clients and recognizer plugins using QtSensorGestures - -\section1 Overview - -The Emulator can be used for both creating client apps using Qt's built-in sensor gestures, -and for creating customized recognizers. - -\section1 Developing Sensor Gesture Clients - -For instance, the Emulator can be used for writing a client app that needs -to use the "slam" gesture. - -Under the "Sensors" heading in the Emulator control, you will see an edit -box for "Sensor gestures" that will contain a list of signals available -when your client instantiates a QSensorGesture. - -Select "slam", and then click the "Send" button -to send a detected("slam") signal to the client. - -*/ diff --git a/src/sensors/doc/src/qtsensorgestures-plugins.qdoc b/src/sensors/doc/src/qtsensorgestures-plugins.qdoc deleted file mode 100644 index b181c16b..00000000 --- a/src/sensors/doc/src/qtsensorgestures-plugins.qdoc +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\group sensorgesture_plugins_topics -\title QtSensorGestures Plugins -\brief Explains how to develop recognizer plugins with QtSensorGestures - -The QtSensorGestures recognizer plugins are the way to create your own -sensor gestures. - -Creating software to recognize motion gestures using sensors is a huge subject not covered here. - -The QSensorGesture API does not limit usage to any of the common classification methods of gesture -recognition, such as Hidden Markov Models, Neural Networks, Dynamic Time Warping, or even the -ad-hoc heuristic recognizers of Qt's built-in sensor gesture recognizers. It's basically a -signaling system for lower level gesture recogition methods and algorithms to communicate to the -higher level applications. - -\tableofcontents - -\section1 Overview - - The steps for creating a sensor gesture plugin are as follows: -\list -\li Sub-class from QSensorGesturePluginInterface -\li Sub-class from QSensorGestureRecognizer and implement gesture recognizer logic using QtSensors. -\li Create an instance of that recognizer in the derived QSensorGesturePluginInterface class, and call - QSensorGestureManager::registerSensorGestureRecognizer(sRec); in your registerRecognizers() -function. QSensorGestureManager will retain ownership of the recognizer object. - -This is the class in which the gesture recognizer system should be implemented from. - -\endlist - -\snippet sensorgestures/plugin.cpp Plugin - - -\section2 Recognizer Classes - -If you are making sensorgestures available through the QtSensorGestures API, these are the -classes to subclass. - -\annotatedlist sensorgestures_recognizer - -\target Qt Sensor Gestures -\section3 Recognizer Plugins - -The Sensor Gesture Recognizers that come with Qt are made using an ad-hoc heuristic approach. -The user cannot define their own gestures, and must learn how to perform and accommodate the -pre-defined gestures herein. - -A developer may use any method, including computationally- and training-intensive well- -known classifiers, to produce gesture recognizers. There are currently no classes in Qt for -gesture training, nor is it possible for the user to define his own sensor-based motion gestures. - -A procedure for writing ad-hoc recognizers might include: -\list - \li Obtain and gather output from the accelerometer through \c QAccelerometerReading of a gesture being performed. - \li Use various methods and constraints on the accelerometer data to recognize the various states: - \list i - \li Initial "listening" state for a gesture - \li Start of a possible gesture, moving into a "detecting" state - \li End of a possible gesture, moving into a "recognizing" state - \li and finally, if it is recognized, the "recognized" state, or if not recognized, move back to - the "listening" state. - \endlist - \li Test procedure to make sure it is easy to perform, and will not - produce too many false positive recognitions, or collisions if used with other gestures. Meaning -that gestures performed get recognized as another gesture instead. - -\endlist - -Below you will find a list of included plugins and their signals. - -For the ShakeGestures plugin: - \table - \row - \li Recognizer Id - \li Signals - \row - \li QtSensors.shake - \li shake -\endtable - -For the QtSensorGestures plugin: - \table - \row - \li Recognizer Id - \li Signals - \li Description - \li Images - \row - \li QtSensors.cover - \li cover - \li Hand covers up phone display for one second, when it's face up, using the Proximity and Orientation sensors. - \li \image sensorgesture-cover.png - \row - \li QtSensors.doubletap - \li doubletap - \li Double tap of finger on phone, using the DoubleTap sensor. - \li \image sensorgesture-doubletap.png - \row - \li QtSensors.hover - \li hover - \li Hand hovers about 4 cm above the phone for more than 1 second, then is removed when face up, - using the IR Proximity sensor. - \li \image sensorgesture-hover.png - \row - \li QtSensors.pickup - \li pickup - \li Phone is resting face up on a flat curface, and is then picked up and brought up into viewing position. Uses the Accelerometer sensor. - \li \image sensorgesture-faceup.png - \row - \li QtSensors.shake2 - \li shakeLeft, shakeRight, shakeUp, shakeDown - \li Shake phone in a certain direction, using the Accelerometer sensor. - \li \image sensorgesture-shake.png - \row - \li QtSensors.slam - \li slam - \li Phone is held in a top up position with a side facing forward for a moment. Swing it quickly with a downward motion - like it is being used to point at something with the top corner. Uses the Accelerometer and Orientation sensors. - \li \image sensorgesture-slam_1.png - \image sensorgesture-slam_2.png - \row - \li QtSensors.turnover - \li turnover - \li Phone is turned face down and placed on a surface, using Proximity and Orientation sensors. - \li \image sensorgesture-facedown.png - \row - \li QtSensors.twist - \li twistLeft, twistRight - \li Phone is held face up and then twisted left or right (left side up or right side up) and back, using the Accelerometer and Orientation sensors. - \li \image sensorgesture-twist.png - \row - \li QtSensors.whip - \li whip - \li Move phone quickly down and then back up. Uses the Accelerometer and Orientation sensors. - \li \image sensorgesture-whip.png - \endtable - -*/ diff --git a/src/sensors/doc/src/qtsensors-backend.qdoc b/src/sensors/doc/src/qtsensors-backend.qdoc index 7e62186d..35945f61 100644 --- a/src/sensors/doc/src/qtsensors-backend.qdoc +++ b/src/sensors/doc/src/qtsensors-backend.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page sensors-backend-topics.html @@ -89,9 +65,9 @@ An example follows. Sensors was designed so that multiple sensors could exist for a given type. Why? Consider this example. -The N900 has an accelerometer built-in. It also features bluetooth and can pair -with a gaming controller that features an accelerometer. To a developer writing -a game these two devices are conceptually the same type. +An Android device has an accelerometer built-in. It also features bluetooth and +can pair with a gaming controller that features an accelerometer. To a developer +writing a game these two devices are conceptually the same type. \section1 Default Sensor for a Type @@ -109,21 +85,28 @@ instead. \section1 Sensors.conf -The config file that determines the default sensor for a type is called Sensors.conf. -If present, it is located in /etc/xdg/QtProject. It has the standard formatting -of an ini file. +The config file that determines the default sensor for a type is called +\e Sensors.conf. The configuration file is looked for from \e QtProject +directory under the directories given by +QStandardPaths::standardLocations(QStandardPaths::ConfigLocation). +An example of a complete file path is: +\badcode +/etc/xdg/QtProject/Sensors.conf +\endcode +The first found configuration file is used. +The configuration file has the standard formatting of an ini file. The settings live in the Default group and the general format is: \code type = identifier \endcode -An example: Sensors.conf ensures that the N900 accelerometer is used by default, -not considering the order in which backends were registered. +An example: Sensors.conf ensures that the \e sensorfw accelerometer is used by +default, ignoring the order in which backends were registered. \code [Default] -QAccelerometer = n900.accelerometer +QAccelerometer=sensorfw.accelerometer \endcode If Sensors.conf specifies an identifier that is not registered, the system will diff --git a/src/sensors/doc/src/qtsensors-cpp.qdoc b/src/sensors/doc/src/qtsensors-cpp.qdoc index d732a0dd..b70f8276 100644 --- a/src/sensors/doc/src/qtsensors-cpp.qdoc +++ b/src/sensors/doc/src/qtsensors-cpp.qdoc @@ -1,34 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtsensors-cpp.html \title Qt Sensors C++ Overview \brief Explains how to use the Qt Sensors C++ API. +\ingroup explanation \tableofcontents @@ -103,8 +80,18 @@ This code does not require any compile-time links to \l QAccelerometer or \snippet sensors/start.cpp Starting a sensor -You can discover all of this information at runtime too. The sensor_explorer example -shows you information about available sensors. +You can discover all of this information at runtime too. + +\section1 Discovering Sensors And Reading Properties At Runtime + +Sometimes it may be that the available sensors are not known at development time. +It is possible to find out which sensors are available as illustrated below: + +\snippet sensors/start.cpp Find sensors + +Furthermore it is possible to discover the reading details for these sensors, as illustrated below: + +\snippet sensors/start.cpp Print reading properties \section1 Front End, Back End diff --git a/src/sensors/doc/src/qtsensors-modules.qdoc b/src/sensors/doc/src/qtsensors-modules.qdoc new file mode 100644 index 00000000..7a4d29ba --- /dev/null +++ b/src/sensors/doc/src/qtsensors-modules.qdoc @@ -0,0 +1,58 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + + +/*! + \module QtSensors + \title Qt Sensors C++ Classes + \qtcmakepackage Sensors + \ingroup modules + \qtvariable sensors + + \brief Provides classes for reading sensor data. + + Mobile devices contain sensor hardware that allow detecting changes in various physical + properties of the device itself or its immediate environment. Examples of device properties + include the angle at which the device is held, whereas environmental properties include for + example the current level of ambient light. +*/ + +/*! + \qmlmodule QtSensors + \title Qt Sensors QML Types + \ingroup qmlmodules + + \brief Provides QML types for reading sensor data. + + \section1 QML Sensors Module API + + QmlSensors is a module API that provides information about currently + available sensors types, identifiers, and the default sensors. + + \qml + import QtSensors + // ... + Component.onCompleted: { + var types = QmlSensors.sensorTypes(); + console.log(types.join(", ")); + } + \endqml + + The documentation for the module API can be found in QmlSensors. + + \section1 QML Sensor Types + + These types represent specific types of sensors. + + Note that most properties come from the abstract \l{Sensor}{Sensor} element. + + \annotatedlist qml-sensors_type + + \section1 QML Reading Types + + The data from a sensor comes via a reading class. + + \annotatedlist qml-sensors_reading + + \section1 All QML Types +*/ diff --git a/src/sensors/doc/src/qtsensors-tutorial.qdoc b/src/sensors/doc/src/qtsensors-tutorial.qdoc new file mode 100644 index 00000000..147b8504 --- /dev/null +++ b/src/sensors/doc/src/qtsensors-tutorial.qdoc @@ -0,0 +1,36 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page qtsensors-tutorial.html + \title How to create your own Sensor + \brief Steps for creating your own sensors + + The Qt Sensors module provides access to sensor hardware via QML and C++ + interfaces. + + The API is supported on \l{Qt for Android}{Android}, \l{Qt for iOS}{iOS}, and + \l {Qt for Windows}{Windows (MSVC)}. + + \section1 Creating your own sensor using C++ API + + Using a Qt module's C++ API requires linking against the module library, either + directly or through other dependencies. + \section2 Creating a sensor + + To create your own sensor you can use the following steps: + + \list + \li Create your own MySensor and MySensorReading classes + \snippet sensors/tutorial.cpp MySensor + \li Create a MySensorBackend by inheriting from QSensorBackend + \li Create MySensorBackendFactory factory class for instantiating that + backend by inheriting a class QSensorBackendFactory + \li Register the backend factory by calling + QSensorManager::registerBackend ("MySensorType", "MySensorId", &myfactory) + \li Instantiate the new MySensor and start using it + \endlist + + As an another option the sensors are put into a \l {Creating a sensor plugin} + that you can use on demand. +*/ diff --git a/src/sensors/doc/src/qtsensors.qdoc b/src/sensors/doc/src/qtsensors.qdoc index 782eef75..c25349fd 100644 --- a/src/sensors/doc/src/qtsensors.qdoc +++ b/src/sensors/doc/src/qtsensors.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtsensors-index.html @@ -31,93 +7,67 @@ \brief Provides access to sensors via QML and C++ interfaces. \since 5.1 - The Qt Sensors API provides access to sensor hardware via QML and C++ interfaces. - The Qt Sensors API also provides a motion gesture recognition API for devices. - - Currently the API is supported on \l{Qt for Android}{Android}, - \l{Qt for iOS}{iOS}, \l{https://sailfishos.org}{SailFish}, and - \l{Qt for UWP}{Universal Windows Platform (UWP)}. - - \section1 Information for Application Writers - - Applications can access Qt Sensors using QML or C++. - - \table - \row - \li \l {Qt Sensors QML Types}{QML Types} - \li Information about the Qt Sensors QML API - \row - \li \l {Qt Sensors C++ Classes}{C++ Classes} - \li Information about the Qt Sensors C++ API - \row - \li \l{Qt Sensors C++ Overview} - \li High-level information on how to use the C++ API. - \row - \li \l {Sensor Gestures C++ Overview} - \li High-level information specific to sensor gestures - \row - \li \l {Qt Sensors Examples}{Examples} - \li Examples demonstrating the use of the Qt Sensors APIs - \endtable - - \section1 Information for Backend Implementors - - \table - \row - \li \l {Qt Sensors Backend}{Backend} - \li Information about the Qt Sensors back end - \row - \li \l {Qt Sensors - Grue Sensor Example} - \li The Qt Sensors - Grue Sensor Example demonstrates creation of a sensor backend - \endtable - - \section1 Compatibility with QtMobility Sensors API - - Qt Sensors 5.0 (the initial release) is generally expected to be source compatible - with QtMobility Sensors 1.2. - - \table - \row - \li \l {Porting Applications from QtMobility Sensors to Qt Sensors}{Porting Guide} - \li Information about the steps needed to port applications to the Qt Sensors API. - \endtable - - \omit - \section1 Information for Qt SensorGestures API - - Qt SensorGestures provides a motion gesture recognition API for devices. - - \table - \row - \li \l {SensorGesture}{QML API} - \li Information about the Qt SensorGestures QML API - \row - \li \l {QtSensorGestures C++ API}{C++ API} - \li Information about the Qt SensorGestures C++ API - \endtable - - \section1 Information for Qt SensorGestures Recognizer Plugin Implementors - - \table - \row - \li \l {QtSensorGestures Plugins}{Plugins} - \li Information about the Qt SensorGestures recognizer plugins. - \row - \li \l {QtSensorGestures Emulator}{Emulator} - \li Information about Qt SensorGestures use in the Emulator. - \endtable - \endomit - - \section1 Platform-specific Information - \table - \row - \li \l {Compatibility Map}{Compatibility Map} - \li Compatibility map of all supported platforms. - \row - \li \l {Generic Backend}{Generic Backend} - \li Information about the generic sensor backend. - \row - \li \l {Sensorfw Backend}{Sensorfw Backend} - \li Information about the Sensorfw sensor backend. - \endtable + The Qt Sensors module provides access to sensor hardware via QML and C++ + interfaces. + + Currently, the API is supported on \l{Qt for Android}{Android}, + \l{Qt for iOS}{iOS}, and \l {Qt for Windows}{Windows (MSVC)}. + + \section1 Using the Module + + \section2 QML API + + \include {module-use.qdocinc} {using the qml api} {QtSensors} + + \section2 C++ API + + \include {module-use.qdocinc} {using the c++ api} + + \section3 Building with CMake + + \include {module-use.qdocinc} {building with cmake} {Sensors} + + \section3 Building with qmake + + \include {module-use.qdocinc} {building_with_qmake} {sensors} + + \section1 Articles and Guides + + \list + \li \l {Qt Sensors C++ Overview} + \li \l {Generic Backend} {Generic Backend} + \li \l {Qt Sensors Backend} + \li \l {Compatibility Map} {Compatibility Map} + \li \l {How to create your own Sensor} + \endlist + + \section1 Examples + + \list + \li \l {Qt Sensors Examples} {Examples} + \endlist + + \section1 API Reference + + \list + \li \l {Qt Sensors QML Types} {QML Types} + \li \l {Qt Sensors C++ Classes} {C++ Classes} + \endlist + + \section1 Module Evolution + \l{Changes to Qt Sensors} lists important changes in the module API + and functionality that were made for the Qt 6 series of Qt. + + \section1 Licenses and Attributions + + The Qt Sensors module is available under commercial licenses from + \l{The Qt Company}. In addition, it is available under free software licenses: + The \l{GNU Lesser General Public License, version 3}, or + the \l{GNU General Public License, version 2}. + See \l{Qt Licensing} for further details. + + Furthermore, Qt Sensors in Qt \QtVersion may contain third-party + modules under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtsensors} */ diff --git a/src/sensors/doc/src/qtsensors5.qdoc b/src/sensors/doc/src/qtsensors5.qdoc deleted file mode 100644 index 403f3282..00000000 --- a/src/sensors/doc/src/qtsensors5.qdoc +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -/*! - \module QtSensors - \title Qt Sensors C++ Classes - \ingroup modules - \qtvariable sensors - - \brief Provides classes for reading sensor data. - - Mobile devices contain sensor hardware that allow detecting changes in various physical - properties of the device itself or its immediate environment. Examples of device properties - include the angle at which the device is held, whereas environmental properties include for - example the current level of ambient light. -*/ - -/*! - \qmlmodule QtSensors 5.\QtMinorVersion - \title Qt Sensors QML Types - \ingroup qmlmodules - - \brief Provides types for reading sensor data. - - \section1 QML Module API - - If the module is imported into a namespace, some additional methods become available. - - \qml \QtMinorVersion - import QtSensors 5.\1 - // ... - Component.onCompleted: { - var types = QmlSensors.sensorTypes(); - console.log(types.join(", ")); - } - \endqml - - The documentation for the module API can be found in QmlSensors. - - \section1 QML Sensor Types - - These types represent specific types of sensors. - - Note that most properties come from the abstract \l{Sensor}{Sensor} element. - - \annotatedlist qml-sensors_type - - \section1 QML Reading Types - - The data from a sensor comes via a reading class. - - \annotatedlist qml-sensors_reading - - \section1 All QML Types -*/ diff --git a/src/sensors/doc/src/sensor-examples.qdoc b/src/sensors/doc/src/sensor-examples.qdoc index 769d8f69..8e8d8d75 100644 --- a/src/sensors/doc/src/sensor-examples.qdoc +++ b/src/sensors/doc/src/sensor-examples.qdoc @@ -1,35 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \group qtsensors-examples \title Qt Sensors Examples \brief Examples for the Qt Sensors module - \ingroup all-examples These are the Qt Sensors examples. diff --git a/src/sensors/doc/src/sensorfwbackend.qdoc b/src/sensors/doc/src/sensorfwbackend.qdoc index 21539bdb..4e3a980d 100644 --- a/src/sensors/doc/src/sensorfwbackend.qdoc +++ b/src/sensors/doc/src/sensorfwbackend.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Jolla Mobile -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Jolla Mobile +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page senorfwbackend.html |