From 9d4d08421acb628e0115b140e54656fc779d13db Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 4 Oct 2012 13:48:23 +0200 Subject: Doc: Modularized the Qt Sensor Docs Change-Id: Ie8636ec443f43b1f238342e0f6f7d321e13dce09 Reviewed-by: Jerome Pasion --- src/sensors/doc/images/XAngle.gif | Bin 0 -> 46224 bytes src/sensors/doc/images/XAngleNegative.gif | Bin 0 -> 38468 bytes src/sensors/doc/images/YAngle.gif | Bin 0 -> 44322 bytes src/sensors/doc/images/YAngleNegative.gif | Bin 0 -> 39741 bytes src/sensors/doc/images/cubehouse.png | Bin 0 -> 39408 bytes src/sensors/doc/images/maze.png | Bin 0 -> 215132 bytes src/sensors/doc/images/qmlqtsensors.png | Bin 0 -> 82345 bytes src/sensors/doc/images/sensorgesture-cover.png | Bin 0 -> 23183 bytes src/sensors/doc/images/sensorgesture-doubletap.png | Bin 0 -> 30073 bytes src/sensors/doc/images/sensorgesture-facedown.png | Bin 0 -> 17917 bytes src/sensors/doc/images/sensorgesture-faceup.png | Bin 0 -> 35115 bytes src/sensors/doc/images/sensorgesture-flat.png | Bin 0 -> 21828 bytes src/sensors/doc/images/sensorgesture-hover.png | Bin 0 -> 22512 bytes src/sensors/doc/images/sensorgesture-shake.png | Bin 0 -> 34512 bytes src/sensors/doc/images/sensorgesture-slam_1.png | Bin 0 -> 26212 bytes src/sensors/doc/images/sensorgesture-slam_2.png | Bin 0 -> 29763 bytes src/sensors/doc/images/sensorgesture-twist.png | Bin 0 -> 29643 bytes src/sensors/doc/images/sensorgesture-whip.png | Bin 0 -> 32058 bytes src/sensors/doc/images/sensors-coordinates.jpg | Bin 0 -> 43508 bytes src/sensors/doc/images/sensors-coordinates2.jpg | Bin 0 -> 58471 bytes src/sensors/doc/images/sensors-coordinates3.jpg | Bin 0 -> 47920 bytes src/sensors/doc/images/sensors-dynamic.png | Bin 0 -> 34911 bytes .../doc/images/sensors-geo-vs-raw-magnetism.jpg | Bin 0 -> 171856 bytes src/sensors/doc/images/sensors-orientation.jpg | Bin 0 -> 39716 bytes src/sensors/doc/images/sensors-overview.png | Bin 0 -> 9670 bytes src/sensors/doc/images/sensors-rotation-anim.gif | Bin 0 -> 296580 bytes src/sensors/doc/images/sensors-rotation.jpg | Bin 0 -> 36653 bytes src/sensors/doc/images/sensors-rotation2.jpg | Bin 0 -> 39953 bytes src/sensors/doc/images/sensors-rotation3.jpg | Bin 0 -> 31417 bytes src/sensors/doc/images/sensors-sides.jpg | Bin 0 -> 48614 bytes src/sensors/doc/images/sensors-sides2.jpg | Bin 0 -> 22706 bytes src/sensors/doc/images/sensors-static.png | Bin 0 -> 23472 bytes src/sensors/doc/qtsensors.qdocconf | 47 ++++++ .../doc/snippets/sensorgestures/creating.cpp | 73 ++++++++ src/sensors/doc/snippets/sensorgestures/main.cpp | 45 +++++ src/sensors/doc/snippets/sensorgestures/myplugin.h | 83 ++++++++++ src/sensors/doc/snippets/sensorgestures/plugin.cpp | 100 +++++++++++ .../doc/snippets/sensorgestures/sensorgestures.pro | 8 + src/sensors/doc/snippets/sensors/creating.cpp | 63 +++++++ src/sensors/doc/snippets/sensors/main.cpp | 45 +++++ src/sensors/doc/snippets/sensors/mybackend.h | 58 +++++++ src/sensors/doc/snippets/sensors/plugin.cpp | 68 ++++++++ src/sensors/doc/snippets/sensors/sensors.pro | 10 ++ src/sensors/doc/snippets/sensors/start.cpp | 58 +++++++ src/sensors/doc/snippets/snippets.pro | 5 + src/sensors/doc/src/compatmap.qdoc | 142 ++++++++++++++++ src/sensors/doc/src/genericbackend.qdoc | 55 ++++++ src/sensors/doc/src/porting.qdoc | 121 ++++++++++++++ src/sensors/doc/src/qtmobilitysensors1.qdoc | 74 +++++++++ src/sensors/doc/src/qtsensorgestures-cpp.qdoc | 60 +++++++ src/sensors/doc/src/qtsensorgestures-emulator.qdoc | 51 ++++++ src/sensors/doc/src/qtsensorgestures-plugins.qdoc | 167 +++++++++++++++++++ src/sensors/doc/src/qtsensors-backend.qdoc | 184 +++++++++++++++++++++ src/sensors/doc/src/qtsensors-cpp.qdoc | 150 +++++++++++++++++ src/sensors/doc/src/qtsensors.qdoc | 117 +++++++++++++ src/sensors/doc/src/qtsensors5.qdoc | 78 +++++++++ src/sensors/doc/src/sensor-examples.qdoc | 40 +++++ src/sensors/gestures/qsensorgesturemanager.cpp | 2 +- src/sensors/qlightsensor.cpp | 2 +- src/sensors/qsensor.cpp | 3 +- src/sensors/qsensorbackend.cpp | 2 +- src/sensors/sensors.pro | 2 +- 62 files changed, 1908 insertions(+), 5 deletions(-) create mode 100644 src/sensors/doc/images/XAngle.gif create mode 100644 src/sensors/doc/images/XAngleNegative.gif create mode 100644 src/sensors/doc/images/YAngle.gif create mode 100644 src/sensors/doc/images/YAngleNegative.gif create mode 100644 src/sensors/doc/images/cubehouse.png create mode 100644 src/sensors/doc/images/maze.png create mode 100644 src/sensors/doc/images/qmlqtsensors.png create mode 100644 src/sensors/doc/images/sensorgesture-cover.png create mode 100644 src/sensors/doc/images/sensorgesture-doubletap.png create mode 100644 src/sensors/doc/images/sensorgesture-facedown.png create mode 100644 src/sensors/doc/images/sensorgesture-faceup.png create mode 100644 src/sensors/doc/images/sensorgesture-flat.png create mode 100644 src/sensors/doc/images/sensorgesture-hover.png create mode 100644 src/sensors/doc/images/sensorgesture-shake.png create mode 100644 src/sensors/doc/images/sensorgesture-slam_1.png create mode 100644 src/sensors/doc/images/sensorgesture-slam_2.png create mode 100644 src/sensors/doc/images/sensorgesture-twist.png create mode 100644 src/sensors/doc/images/sensorgesture-whip.png create mode 100644 src/sensors/doc/images/sensors-coordinates.jpg create mode 100644 src/sensors/doc/images/sensors-coordinates2.jpg create mode 100644 src/sensors/doc/images/sensors-coordinates3.jpg create mode 100644 src/sensors/doc/images/sensors-dynamic.png create mode 100644 src/sensors/doc/images/sensors-geo-vs-raw-magnetism.jpg create mode 100644 src/sensors/doc/images/sensors-orientation.jpg create mode 100644 src/sensors/doc/images/sensors-overview.png create mode 100644 src/sensors/doc/images/sensors-rotation-anim.gif create mode 100644 src/sensors/doc/images/sensors-rotation.jpg create mode 100644 src/sensors/doc/images/sensors-rotation2.jpg create mode 100644 src/sensors/doc/images/sensors-rotation3.jpg create mode 100644 src/sensors/doc/images/sensors-sides.jpg create mode 100644 src/sensors/doc/images/sensors-sides2.jpg create mode 100644 src/sensors/doc/images/sensors-static.png create mode 100644 src/sensors/doc/qtsensors.qdocconf create mode 100644 src/sensors/doc/snippets/sensorgestures/creating.cpp create mode 100644 src/sensors/doc/snippets/sensorgestures/main.cpp create mode 100644 src/sensors/doc/snippets/sensorgestures/myplugin.h create mode 100644 src/sensors/doc/snippets/sensorgestures/plugin.cpp create mode 100644 src/sensors/doc/snippets/sensorgestures/sensorgestures.pro create mode 100644 src/sensors/doc/snippets/sensors/creating.cpp create mode 100644 src/sensors/doc/snippets/sensors/main.cpp create mode 100644 src/sensors/doc/snippets/sensors/mybackend.h create mode 100644 src/sensors/doc/snippets/sensors/plugin.cpp create mode 100644 src/sensors/doc/snippets/sensors/sensors.pro create mode 100644 src/sensors/doc/snippets/sensors/start.cpp create mode 100644 src/sensors/doc/snippets/snippets.pro create mode 100644 src/sensors/doc/src/compatmap.qdoc create mode 100644 src/sensors/doc/src/genericbackend.qdoc create mode 100644 src/sensors/doc/src/porting.qdoc create mode 100644 src/sensors/doc/src/qtmobilitysensors1.qdoc create mode 100644 src/sensors/doc/src/qtsensorgestures-cpp.qdoc create mode 100644 src/sensors/doc/src/qtsensorgestures-emulator.qdoc create mode 100644 src/sensors/doc/src/qtsensorgestures-plugins.qdoc create mode 100644 src/sensors/doc/src/qtsensors-backend.qdoc create mode 100644 src/sensors/doc/src/qtsensors-cpp.qdoc create mode 100644 src/sensors/doc/src/qtsensors.qdoc create mode 100644 src/sensors/doc/src/qtsensors5.qdoc create mode 100644 src/sensors/doc/src/sensor-examples.qdoc (limited to 'src/sensors') diff --git a/src/sensors/doc/images/XAngle.gif b/src/sensors/doc/images/XAngle.gif new file mode 100644 index 00000000..045f235f Binary files /dev/null and b/src/sensors/doc/images/XAngle.gif differ diff --git a/src/sensors/doc/images/XAngleNegative.gif b/src/sensors/doc/images/XAngleNegative.gif new file mode 100644 index 00000000..92fc9233 Binary files /dev/null and b/src/sensors/doc/images/XAngleNegative.gif differ diff --git a/src/sensors/doc/images/YAngle.gif b/src/sensors/doc/images/YAngle.gif new file mode 100644 index 00000000..004fdd15 Binary files /dev/null and b/src/sensors/doc/images/YAngle.gif differ diff --git a/src/sensors/doc/images/YAngleNegative.gif b/src/sensors/doc/images/YAngleNegative.gif new file mode 100644 index 00000000..1dce6532 Binary files /dev/null and b/src/sensors/doc/images/YAngleNegative.gif differ diff --git a/src/sensors/doc/images/cubehouse.png b/src/sensors/doc/images/cubehouse.png new file mode 100644 index 00000000..e3ff7fa5 Binary files /dev/null and b/src/sensors/doc/images/cubehouse.png differ diff --git a/src/sensors/doc/images/maze.png b/src/sensors/doc/images/maze.png new file mode 100644 index 00000000..f3ad8de4 Binary files /dev/null and b/src/sensors/doc/images/maze.png differ diff --git a/src/sensors/doc/images/qmlqtsensors.png b/src/sensors/doc/images/qmlqtsensors.png new file mode 100644 index 00000000..0a54b653 Binary files /dev/null and b/src/sensors/doc/images/qmlqtsensors.png differ diff --git a/src/sensors/doc/images/sensorgesture-cover.png b/src/sensors/doc/images/sensorgesture-cover.png new file mode 100644 index 00000000..7b4fbc5f Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-cover.png differ diff --git a/src/sensors/doc/images/sensorgesture-doubletap.png b/src/sensors/doc/images/sensorgesture-doubletap.png new file mode 100644 index 00000000..6253d0f8 Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-doubletap.png differ diff --git a/src/sensors/doc/images/sensorgesture-facedown.png b/src/sensors/doc/images/sensorgesture-facedown.png new file mode 100644 index 00000000..a85664f1 Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-facedown.png differ diff --git a/src/sensors/doc/images/sensorgesture-faceup.png b/src/sensors/doc/images/sensorgesture-faceup.png new file mode 100644 index 00000000..c20ef089 Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-faceup.png differ diff --git a/src/sensors/doc/images/sensorgesture-flat.png b/src/sensors/doc/images/sensorgesture-flat.png new file mode 100644 index 00000000..e8eafafb Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-flat.png differ diff --git a/src/sensors/doc/images/sensorgesture-hover.png b/src/sensors/doc/images/sensorgesture-hover.png new file mode 100644 index 00000000..fecf6b3a Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-hover.png differ diff --git a/src/sensors/doc/images/sensorgesture-shake.png b/src/sensors/doc/images/sensorgesture-shake.png new file mode 100644 index 00000000..06f9eeaf Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-shake.png differ diff --git a/src/sensors/doc/images/sensorgesture-slam_1.png b/src/sensors/doc/images/sensorgesture-slam_1.png new file mode 100644 index 00000000..d56f8892 Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-slam_1.png differ diff --git a/src/sensors/doc/images/sensorgesture-slam_2.png b/src/sensors/doc/images/sensorgesture-slam_2.png new file mode 100644 index 00000000..5fe8ecba Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-slam_2.png differ diff --git a/src/sensors/doc/images/sensorgesture-twist.png b/src/sensors/doc/images/sensorgesture-twist.png new file mode 100644 index 00000000..bec15854 Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-twist.png differ diff --git a/src/sensors/doc/images/sensorgesture-whip.png b/src/sensors/doc/images/sensorgesture-whip.png new file mode 100644 index 00000000..aa998bb7 Binary files /dev/null and b/src/sensors/doc/images/sensorgesture-whip.png differ diff --git a/src/sensors/doc/images/sensors-coordinates.jpg b/src/sensors/doc/images/sensors-coordinates.jpg new file mode 100644 index 00000000..e2e98908 Binary files /dev/null and b/src/sensors/doc/images/sensors-coordinates.jpg differ diff --git a/src/sensors/doc/images/sensors-coordinates2.jpg b/src/sensors/doc/images/sensors-coordinates2.jpg new file mode 100644 index 00000000..8dd43a21 Binary files /dev/null and b/src/sensors/doc/images/sensors-coordinates2.jpg differ diff --git a/src/sensors/doc/images/sensors-coordinates3.jpg b/src/sensors/doc/images/sensors-coordinates3.jpg new file mode 100644 index 00000000..02634000 Binary files /dev/null and b/src/sensors/doc/images/sensors-coordinates3.jpg differ diff --git a/src/sensors/doc/images/sensors-dynamic.png b/src/sensors/doc/images/sensors-dynamic.png new file mode 100644 index 00000000..d2ba937d Binary files /dev/null and b/src/sensors/doc/images/sensors-dynamic.png differ diff --git a/src/sensors/doc/images/sensors-geo-vs-raw-magnetism.jpg b/src/sensors/doc/images/sensors-geo-vs-raw-magnetism.jpg new file mode 100644 index 00000000..272fa310 Binary files /dev/null and b/src/sensors/doc/images/sensors-geo-vs-raw-magnetism.jpg differ diff --git a/src/sensors/doc/images/sensors-orientation.jpg b/src/sensors/doc/images/sensors-orientation.jpg new file mode 100644 index 00000000..245533d5 Binary files /dev/null and b/src/sensors/doc/images/sensors-orientation.jpg differ diff --git a/src/sensors/doc/images/sensors-overview.png b/src/sensors/doc/images/sensors-overview.png new file mode 100644 index 00000000..29e9ebd4 Binary files /dev/null and b/src/sensors/doc/images/sensors-overview.png differ diff --git a/src/sensors/doc/images/sensors-rotation-anim.gif b/src/sensors/doc/images/sensors-rotation-anim.gif new file mode 100644 index 00000000..22c678d5 Binary files /dev/null and b/src/sensors/doc/images/sensors-rotation-anim.gif differ diff --git a/src/sensors/doc/images/sensors-rotation.jpg b/src/sensors/doc/images/sensors-rotation.jpg new file mode 100644 index 00000000..1bd1b14b Binary files /dev/null and b/src/sensors/doc/images/sensors-rotation.jpg differ diff --git a/src/sensors/doc/images/sensors-rotation2.jpg b/src/sensors/doc/images/sensors-rotation2.jpg new file mode 100644 index 00000000..1bf34fee Binary files /dev/null and b/src/sensors/doc/images/sensors-rotation2.jpg differ diff --git a/src/sensors/doc/images/sensors-rotation3.jpg b/src/sensors/doc/images/sensors-rotation3.jpg new file mode 100644 index 00000000..d69a3e19 Binary files /dev/null and b/src/sensors/doc/images/sensors-rotation3.jpg differ diff --git a/src/sensors/doc/images/sensors-sides.jpg b/src/sensors/doc/images/sensors-sides.jpg new file mode 100644 index 00000000..8e842242 Binary files /dev/null and b/src/sensors/doc/images/sensors-sides.jpg differ diff --git a/src/sensors/doc/images/sensors-sides2.jpg b/src/sensors/doc/images/sensors-sides2.jpg new file mode 100644 index 00000000..db66a9b5 Binary files /dev/null and b/src/sensors/doc/images/sensors-sides2.jpg differ diff --git a/src/sensors/doc/images/sensors-static.png b/src/sensors/doc/images/sensors-static.png new file mode 100644 index 00000000..657aaad2 Binary files /dev/null and b/src/sensors/doc/images/sensors-static.png differ diff --git a/src/sensors/doc/qtsensors.qdocconf b/src/sensors/doc/qtsensors.qdocconf new file mode 100644 index 00000000..c2d27bca --- /dev/null +++ b/src/sensors/doc/qtsensors.qdocconf @@ -0,0 +1,47 @@ +include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtSensors +description = Qt Contacts Reference Documentation +url = http://qt-project.org/doc/qt-5.0/qtsensors-index.html +version = 5.0.0 + +qhp.projects = QtSensors + +qhp.QtSensors.file = qtsensors.qhp +qhp.QtSensors.namespace = org.qt-project.qtsensors.500 +qhp.QtSensors.virtualFolder = qdoc +qhp.QtSensors.indexTitle = Qt Sensors Reference Documentation +qhp.QtSensors.indexRoot = + +qhp.QtSensors.filterAttributes = qtsensors 5.0.0 qtrefdoc +qhp.QtSensors.customFilters.Qt.name = QtSensors 5.0.0 +qhp.QtSensors.customFilters.Qt.filterAttributes = qtsensors 5.0.0 +qhp.QtSensors.subprojects = classes overviews examples +qhp.QtSensors.subprojects.classes.title = Classes +qhp.QtSensors.subprojects.classes.indexTitle = Qt Sensors's Classes +qhp.QtSensors.subprojects.classes.selectors = class fake:headerfile +qhp.QtSensors.subprojects.classes.sortPages = true +qhp.QtSensors.subprojects.overviews.title = Overviews +qhp.QtSensors.subprojects.overviews.indexTitle = All Overviews and HOWTOs +qhp.QtSensors.subprojects.overviews.selectors = fake:page,group,module +qhp.QtSensors.subprojects.examples.title = Qt Sensors Examples +qhp.QtSensors.subprojects.examples.indexTitle = Qt Sensors Examples +qhp.QtSensors.subprojects.examples.selectors = fake:example + +outputdir = ../../../doc/qtsensors +tagfile = ../../../doc/qtsensors/qtsensors.tags + +headerdirs += .. \ + ../../imports/sensors2 \ + ../../plugins/sensors + +sourcedirs += .. \ + ../../imports/sensors2 \ + ../../plugins/sensors + +exampledirs += ../../../examples/sensors \ + snippets/ + + +imagedirs += images diff --git a/src/sensors/doc/snippets/sensorgestures/creating.cpp b/src/sensors/doc/snippets/sensorgestures/creating.cpp new file mode 100644 index 00000000..214f2d45 --- /dev/null +++ b/src/sensors/doc/snippets/sensorgestures/creating.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +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 new file mode 100644 index 00000000..08db48c6 --- /dev/null +++ b/src/sensors/doc/snippets/sensorgestures/main.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $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 new file mode 100644 index 00000000..d75f3cef --- /dev/null +++ b/src/sensors/doc/snippets/sensorgestures/myplugin.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYPLUGIN_H +#define MYPLUGIN_H + +#include +#include +#include + +class MySensorGestureRecognizer : public QSensorGestureRecognizer +{ + Q_OBJECT + public: + + MySensorGestureRecognizer(QObject *parent = 0); + ~MySensorGestureRecognizer(); + + void create(); + + QString id() const; + bool start(); + bool stop(); + bool isActive(); + +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 createRecognizers(); + QStringList supportedIds() const; + QString name() const { return "MyGestures"; } +}; + +#endif diff --git a/src/sensors/doc/snippets/sensorgestures/plugin.cpp b/src/sensors/doc/snippets/sensorgestures/plugin.cpp new file mode 100644 index 00000000..77982904 --- /dev/null +++ b/src/sensors/doc/snippets/sensorgestures/plugin.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "myplugin.h" + +#include +#include + +//! [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 MySensorGesturePlugin::createRecognizers() +{ + QList 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 new file mode 100644 index 00000000..46d68250 --- /dev/null +++ b/src/sensors/doc/snippets/sensorgestures/sensorgestures.pro @@ -0,0 +1,8 @@ +TEMPLATE=app +TARGET=sensorgesturessdocsnippet +QT += sensors +SOURCES+=main.cpp\ + creating.cpp\ + plugin.cpp +HEADERS+=myplugin.h +!win32:*g++*:LIBS+=-rdynamic diff --git a/src/sensors/doc/snippets/sensors/creating.cpp b/src/sensors/doc/snippets/sensors/creating.cpp new file mode 100644 index 00000000..01e3e369 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/creating.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +class MyObject : public QObject +{ + void create(); +}; + +void MyObject::create() +{ +//! [Creating a sensor] +// On the heap (deleted when this object is deleted) +QAccelerometer *sensor = new QAccelerometer(this); + +// On the stack (deleted when the current scope ends) +QOrientationSensor orient_sensor; +//! [Creating a sensor] + + Q_UNUSED(sensor) + Q_UNUSED(orient_sensor); +} + diff --git a/src/sensors/doc/snippets/sensors/main.cpp b/src/sensors/doc/snippets/sensors/main.cpp new file mode 100644 index 00000000..08db48c6 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/main.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +int main(int /*argc*/, char ** /*argv*/) +{ + return 0; +} + diff --git a/src/sensors/doc/snippets/sensors/mybackend.h b/src/sensors/doc/snippets/sensors/mybackend.h new file mode 100644 index 00000000..49d9d3c4 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/mybackend.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYBACKEND_H +#define MYBACKEND_H + +#include +#include + +class MyBackend : public QSensorBackend +{ +public: + MyBackend(QSensor *sensor) : QSensorBackend(sensor) {} + void stop() {} + void start() {} + void poll() {} + + static const char *id; +}; + +#endif diff --git a/src/sensors/doc/snippets/sensors/plugin.cpp b/src/sensors/doc/snippets/sensors/plugin.cpp new file mode 100644 index 00000000..e467128f --- /dev/null +++ b/src/sensors/doc/snippets/sensors/plugin.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mybackend.h" +#include +#include + +const char *MyBackend::id = "mybackend"; + +//! [Plugin] +class MyPluginClass : public QObject, public QSensorPluginInterface, public QSensorBackendFactory +{ + Q_OBJECT + //Q_PLUGIN_METADATA(IID "com.nokia.Qt.QSensorPluginInterface/1.0" FILE "plugin.json") + Q_INTERFACES(QSensorPluginInterface) +public: + void registerSensors() + { + QSensorManager::registerBackend(QAccelerometer::type, MyBackend::id, this); + } + + QSensorBackend *createBackend(QSensor *sensor) + { + if (sensor->identifier() == MyBackend::id) + return new MyBackend(sensor); + return 0; + } +}; +//! [Plugin] + +#include "plugin.moc" diff --git a/src/sensors/doc/snippets/sensors/sensors.pro b/src/sensors/doc/snippets/sensors/sensors.pro new file mode 100644 index 00000000..20b5ae51 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/sensors.pro @@ -0,0 +1,10 @@ +TEMPLATE=app +TARGET=sensorsdocsnippet +QT += 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 new file mode 100644 index 00000000..d8cbd993 --- /dev/null +++ b/src/sensors/doc/snippets/sensors/start.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +void start() +{ +//! [Starting a sensor] +// start the sensor +QSensor sensor("QAccelerometer"); +sensor.start(); + +// later +QSensorReading *reading = sensor.reading(); +qreal x = reading->property("x").value(); +qreal y = reading->value(1).value(); +//! [Starting a sensor] + + Q_UNUSED(x) + Q_UNUSED(y) +} diff --git a/src/sensors/doc/snippets/snippets.pro b/src/sensors/doc/snippets/snippets.pro new file mode 100644 index 00000000..f73d4a35 --- /dev/null +++ b/src/sensors/doc/snippets/snippets.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +SUBDIRS += sensors +SUBDIRS += sensorgestures + diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc new file mode 100644 index 00000000..0fd4951c --- /dev/null +++ b/src/sensors/doc/src/compatmap.qdoc @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page compatmap.html + \title Compatibility Map + \brief Overview of supported sensors for each platform + + \raw HTML + + + + + + + + + + + + + + + + +
ColorExplanation
The feature is fully supported.
The feature is not supported.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureBlackberryLinuxGeneric
Accelerometer
Ambient Light Sensor
Compass
Gyroscope
IR Proximity Sensor
Light Sensor
Magnetometer
Orientation Sensor
Proximity Sensor
Rotation Sensor
Tap Sensor
Sensor Gestures1)
+ + \endraw + + 1) Support depends on the underlying platform + + 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. +*/ + diff --git a/src/sensors/doc/src/genericbackend.qdoc b/src/sensors/doc/src/genericbackend.qdoc new file mode 100644 index 00000000..689b4124 --- /dev/null +++ b/src/sensors/doc/src/genericbackend.qdoc @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page genericbackend.html + \title Generic Backend + \brief Information about the generic sensor backend + + The generic sensor backend provides emulation of some of the sensors that are not supported on the + platform. + For example, on a platform without a rotation sensor but with an accelerometer, the accelerometer + is used to calculate the rotation, thus providing an emulated rotation sensor. + + The following generic sensors are supported: + \table + \header + \li Emulated Sensor + \li Source Sensor + \row + \li Ambient Light Sensor + \li Light Sensor + \row + \li Orientation Sensor + \li Accelerometer + \row + \li Rotation Sensor + \li Accelerometer + \endtable + If a platform doesn't support the source sensor, then the sensor can not be emulated. +*/ + diff --git a/src/sensors/doc/src/porting.qdoc b/src/sensors/doc/src/porting.qdoc new file mode 100644 index 00000000..b52da351 --- /dev/null +++ b/src/sensors/doc/src/porting.qdoc @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtsensors-porting.html + \title Porting Applications from QtMobility Sensors to Qt Sensors + + \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 must be changed in order to port applications to Qt Sensors. + + \section1 QML + + Compatibility for QML applications is provided by shipping the legacy \c QtMobility.sensors + QML import. QML applications should not require any changes to continue operating. + + Applications using the legacy QML import may not be able to trivially port over + to the new QML import because the new QML import does not provide types for + every sensor like the legacy QML import does. + + \table + \row + \li \l {Qt Sensors QML Types}{QML API} + \li Information about the Qt Sensors QML API + \row + \li \l {QtMobility.sensors 1.x}{Legacy QML API} + \li Information about the legacy QtMobility.sensors QML API + \endtable + + \section1 C++ + + \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 + #include + #include + #include + \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 this to enable the Qt Sensors API. + + \code + QT += sensors + \endcode +*/ + diff --git a/src/sensors/doc/src/qtmobilitysensors1.qdoc b/src/sensors/doc/src/qtmobilitysensors1.qdoc new file mode 100644 index 00000000..f9ba814f --- /dev/null +++ b/src/sensors/doc/src/qtmobilitysensors1.qdoc @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlmodule QtMobility.sensors 1.3 + \title QtMobility.sensors 1.x + \brief Legacy QML import for QtSensors + + \section1 Overview + + This is the legacy QML import. It exists for compatibility with the QtMobiltiy 1.2 release + and is not recommended for new applications. + + See \l{Qt Sensors} for more information about the Sensors API. + + \section1 QML Module API + + See \l {Qt Sensors} for more information about the Sensors API. + + If the module is imported into a namespace, some additional methods become available. + + \code + import QtMobility.sensors 1.3 as Sensors + ... + Component.onCompleted: { + var types = Sensors.sensorTypes(); + console.log(types.join(", ")); + } + \endcode + + The documentation for the module API can be found in SensorGlobal. + + \section1 QML Sensor types + + These types represent specific types of sensors. + + Note that most properties come from the abstract \l{QtMobility.sensors1::Sensor}{Sensor} element. + + \annotatedlist qml-sensors_type + + \section1 QML Reading types + + The data from a sensor comes through a reading class. + + \annotatedlist qml-sensors_reading + + \section1 Alphabetical Listing of QML Types + +*/ + diff --git a/src/sensors/doc/src/qtsensorgestures-cpp.qdoc b/src/sensors/doc/src/qtsensorgestures-cpp.qdoc new file mode 100644 index 00000000..e78ce4d6 --- /dev/null +++ b/src/sensors/doc/src/qtsensorgestures-cpp.qdoc @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtsensorgestures-cpp.html +\title Sensor Gestures C++ Overview +\brief Information about 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 QtSensorGestures is easy. There are two main classes you will need to use. + +QSensorGestureManager can be used for determining what sensor gestures are available, and +QSensorGesture for connecting the sensor gesture signals. + +\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 + +*/ + diff --git a/src/sensors/doc/src/qtsensorgestures-emulator.qdoc b/src/sensors/doc/src/qtsensorgestures-emulator.qdoc new file mode 100644 index 00000000..af061e2a --- /dev/null +++ b/src/sensors/doc/src/qtsensorgestures-emulator.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\group sensorgesture_emulator_topics +\title QtSensorGestures Emulator +\brief Information about the development of clients and recognizer plugins + using QtSensorGestures + +\section1 Overview + +Whether creating client apps using Qt's built-in sensor gestures, or +creating customized recognizers, the Emulator can be used to help develop client +apps and 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 new file mode 100644 index 00000000..67734aad --- /dev/null +++ b/src/sensors/doc/src/qtsensorgestures-plugins.qdoc @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\group sensorgesture_plugins_topics +\title QtSensorGestures Plugins +\brief Information about the QtSensorGestures recognizer plugins. + +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 to 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-hock heurustic approach. +The user cannot define their own gestures, and must learn how to perform and accomodate 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 ability for the user to define their own sensor based motion gestures. + +A procedure for writing ad-hock recognizers might include: +\list + \li Obtain and gather output from the accelerometer through 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. And if used with other gestures, collisions. Meaning +that gestures performed get recognized as another gesture instead. + +\endlist + +Here is a list of included plugins and their signals + +For ShakeGestures plugin: + \table + \row + \li Recognizer Id + \li Signals + \row + \li QtSensors.shake + \li shake +\endtable + +For 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, using 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. using 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. using 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 new file mode 100644 index 00000000..e26c05ad --- /dev/null +++ b/src/sensors/doc/src/qtsensors-backend.qdoc @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\group sensors_backend_topics +\title Qt Sensors Backend +\brief Information about the Qt Sensors back end + +The Qt Sensors backend connects the Qt Sensors API to the platform services or hardware sensors. + +\tableofcontents + +\section1 Overview + +\section1 Backend API + +QSensor instances talk to a backend object. Backends are usually supplied +with the Qt Sensors library for a specific device although third party +backends may be used as well. A backend may talk +directly to hardware or it may talk to a system service. In some instances +it may even talk to another sensor. +An example of this is the orientation sensor backend that talks to an +accelerometer to determine the device orientation. + +\section1 Backend Classes +If you are making sensors available through the Sensors API, these are the +classes to use. +\annotatedlist sensors_backend + +\section1 Backend Topics + +\generatelist related + +*/ + +/*! +\page creating-a-sensor-plugin.html +\title Creating a sensor plugin +\ingroup sensors_backend_topics + +\section1 How a sensor plugin is loaded + +Since sensor backends are created on demand, the sensor plugin is loaded and asked +to register the sensor backends it handles. The plugin should implement +QSensorPluginInterface::registerSensors() and call QSensorManager::registerBackend() +to register available backends. Typically the plugin will also inherit from +QSensorBackendFactory and implement +QSensorBackendFactory::createBackend() in order to instantiate backends it has registered. + +The simplest plugin will have just once sensor backend although there is no reason +that multiple sensor backends cannot be in a plugin. + +An example follows. + +\snippet sensors/plugin.cpp Plugin + +*/ + +/*! +\page determining-the-default-sensor-for-a-type.html +\title Determining the default sensor for a type +\ingroup sensors_backend_topics + +\section1 Multiple sensors can exist for a type + +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. + +\section1 Default sensor for a type + +To avoid the need to know (or check) what the default sensor for a type is, the system will +use the default sensor for a type. Most of the time this is what the app developer wants to +do. In cases where the app developer wants to select a specific sensor they must call the +QSensor::setIdentifier() method before they start the sensor so that the appropriate backend +is used. + +From a system perspective though, selecting which sensor should be the default gets tricky. +The sensors library uses the first registered identifier as the default. This means that the +order in which sensor backends are registered is important so the system will allow a config +file to determine the default 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/Nokia. It 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 that ensures the N900 accelerometer is used as the default no matter the +order in which backends were registered is presented here. + +\code +[Default] +QAccelerometer = n900.accelerometer +\endcode + +If Sensors.conf specifies an identifier that is not registered then the system will fall back to +the first registered identifier as the default. + +Note that there is special case logic to prevent the generic plugin's backends from becoming the +default when another backend is registered for the same type. This logic means that a backend +identifier starting with \c{generic.} will only be the default if no other backends have been +registered for that type or if it is specified in \c{Sensors.conf}. + +*/ + +/*! +\page dynamic-sensor-backend-registration.html +\title Dynamic Sensor Backend Registration +\ingroup sensors_backend_topics + +\section1 Static Backend Registration + +Sensor backends are generally registered statically. The registration happens when the sensors +library is first used and the registration remains in effect while the program runs. + +\image sensors-static.png + +Statically registered backends may still exhibit some dynamic behaviour as the +QSensorBackendFactory is free to return 0 to indicate that a backend cannot be created. + +\section1 Dynamic Backend Registration + +While static registration is fine for most backends there are some situations where this is +problematic. + +The clearest example is backends that represent non-fixed hardware. As an example, lets consider +a game controller that is connected via Bluetooth. As there may be more than one game controller +in range of the phone, the program wants to record that a specific game controller should be used. +If the backend had been registered statically there would have been no unique information about +the controller. Instead, the registration is delayed until the controller is seen. + +\image sensors-dynamic.png + +\section1 Suggested Registration Policy + +A backend for fixed hardware should be registered immediately. Applications can see that the +sensor can be used. + +A backend for remote hardware should not be registered immediately. Applications can see that +the sensor cannot be used. When the remote hardware becomes available the backend should be +registered. Applications can see that the sensor is now available. + +If it is necessary to return 0 from a factory for a backend that was registered, the backend +should be unregistered. Applications can see that the sensor is no longer available. If the +factory can create the backend again it should be registered. Applications can see that the +sensor is available again. + +When the underlying hardware is no longer available, the backend should be deregistered. +Existing instances of the backend should report error states to the application but should +handle the situation gracefully. + +*/ diff --git a/src/sensors/doc/src/qtsensors-cpp.qdoc b/src/sensors/doc/src/qtsensors-cpp.qdoc new file mode 100644 index 00000000..2f60592a --- /dev/null +++ b/src/sensors/doc/src/qtsensors-cpp.qdoc @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtsensors-cpp.html +\title Qt Sensors C++ Overview +\brief Information about the Qt Sensors C++ API + +\tableofcontents + +\section1 Sensor Types + +On a device there can be many types of sensors. Not all of the types that the Qt Sensors API +supports may be available. There may also be types available that are not defined in the +Qt Sensors API. The types of sensors available on a device is found using the +\l QSensor::sensorTypes() function. + +For a list of built-in sensor types, see the \l{Sensor Classes} section below. + +\section1 Common Conventions + +Unless otherwise specified, Qt Sensors uses the +\l{http://en.wikipedia.org/wiki/Cartesian_coordinate_system}{Right Hand Cartesian coordinate system}. + +\image sensors-coordinates.jpg + +To allow for measurements in all 6 directions, negative values are used. + +\image sensors-coordinates2.jpg + +Where rotation around an axis is used, the rotation shall be expressed as a Right Hand rotation. + +\image sensors-coordinates3.jpg + +In general, sensor data is oriented to the top of the device. If values are to be displayed on +the screen the values may need to be transformed so that they match the user interface orientation. A sensor +may define its data as being oriented to the UI. This will be noted in the documentation for the +sensor. + +\image sensors-sides2.jpg + +\section1 Using a Sensor + +The life cycle of a QSensor is typically: + +\list +\li Create an instance of QSensor or one of its sub-classes on the stack or heap. +\li Setup as required by the application. +\li Start receiving values. +\li Sensor data is used by the application. +\li Stop receiving values. +\endlist + +Here is an example of creating a sensor on the heap and on the stack. + +\snippet sensors/creating.cpp Creating a sensor + +\section1 Accessing sensor data in a generic fashion + +The preferred way to deal with sensor data is via the \l{Reading Classes}. +However, sometimes this may not be possible. For example, you may be deploying +an application to a device that has a new sensor type but no C++ header +describing the reading class is available. + +Thanks to Qt's property system you can still access the sensor data. You need to know +3 pieces of information in order to do this: + +\list +\li The sensor type. +\li The property name or index. +\li The property type or a comparable type. +\endlist + +For example, here is an example of how you can access a property of the accelerometer. +This code does not require any compile-time links to \l QAccelerometer or +\l QAccelerometerReading. + +\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. + +\section1 Front end, back end + +The Qt Sensors API has a front end, for application developers to use and a back end, +where device implementors write code to access their hardware. As an application +developer you do not need to access the back end though it may be useful to understand +how it works. + +Commands from the application are delivered through QSensor and then down to the +device plugin. Data comes back through the QSensorReading class. + +\image sensors-overview.png + +More information about the back end can be found in \l{Qt Sensors Backend}. + +\section1 Main Classes + +The primary classes that make up the Qt Sensors API. + +\annotatedlist sensors_main + +\section1 Reading Classes + +The best way to access sensor data is via one of these classes. + +\annotatedlist sensors_reading + +\section1 Sensor Classes + +These classes provide convenience wrappers that reduce the need for casting. +Each of these classes represents a sensor type that the Qt Sensors API knows +about. Note that additional types may be made available at run-time. See +\l{Sensor Types} for more information. + +\annotatedlist sensors_type + +\section1 Filter Classes + +As with the sensor classes, these provide convenience wrappers that reduce +the need for casting. + +\annotatedlist sensors_filter + +*/ + diff --git a/src/sensors/doc/src/qtsensors.qdoc b/src/sensors/doc/src/qtsensors.qdoc new file mode 100644 index 00000000..61286733 --- /dev/null +++ b/src/sensors/doc/src/qtsensors.qdoc @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtsensors-index.html + \title Qt Sensors + \brief The Qt Sensors API provides access to sensors via QML and C++ interfaces. + \ingroup technology-apis + + The Qt Sensors API provides access to sensor hardware via QML and C++ interfaces. + The Qt Sensors API also provides motion gesture recognition API for devices. + + \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 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. + \endtable +*/ + diff --git a/src/sensors/doc/src/qtsensors5.qdoc b/src/sensors/doc/src/qtsensors5.qdoc new file mode 100644 index 00000000..71b62dae --- /dev/null +++ b/src/sensors/doc/src/qtsensors5.qdoc @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +/*! + \module QtSensors + \title Qt Sensors C++ Classes + \ingroup modules + + \brief The QtSensors module provides classes for reading sensor data. + + Mobile devices contains 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 + \title Qt Sensors QML Types + \ingroup qmlmodules + + \brief The QtSensors QML module provides types for reading sensor data. + + \section1 QML Module API + + If the module is imported into a namespace, some additional methods become available. + + \code + import QtSensors 5.0 as Sensors + ... + Component.onCompleted: { + var types = Sensors.sensorTypes(); + console.log(types.join(", ")); + } + \endcode + + The documentation for the module API can be found in SensorGlobal. + + \section1 QML Sensor types + + These types represent specific types of sensors. + + Note that most properties come from the abstract \l{QtSensors::Sensor}{Sensor} element. + + \annotatedlist qml-sensors_type + + \section1 QML Reading types + + The data from a sensor comes through a reading class. + + \annotatedlist qml-sensors_reading +*/ + diff --git a/src/sensors/doc/src/sensor-examples.qdoc b/src/sensors/doc/src/sensor-examples.qdoc new file mode 100644 index 00000000..d934c8a0 --- /dev/null +++ b/src/sensors/doc/src/sensor-examples.qdoc @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtsensors-examples + \title Qt Sensors Examples + \brief Examples for the Qt Sensors module + \ingroup all-examples + + These are the Qt Sensors examples. + + \generatelist related +*/ + + + diff --git a/src/sensors/gestures/qsensorgesturemanager.cpp b/src/sensors/gestures/qsensorgesturemanager.cpp index 897e72f0..969347a2 100644 --- a/src/sensors/gestures/qsensorgesturemanager.cpp +++ b/src/sensors/gestures/qsensorgesturemanager.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE Sensor Gesture plugins register their recognizers using the registerSensorGestureRecognizer() function. - \snippet snippets/sensorgestures/creating.cpp Receiving sensor gesture signals + \snippet sensorgestures/creating.cpp Receiving sensor gesture signals */ diff --git a/src/sensors/qlightsensor.cpp b/src/sensors/qlightsensor.cpp index 30bd1de5..b712bb6e 100644 --- a/src/sensors/qlightsensor.cpp +++ b/src/sensors/qlightsensor.cpp @@ -49,7 +49,7 @@ IMPLEMENT_READING(QLightReading) /*! \class QLightReading \ingroup sensors_reading - + \inmodule QtSensors \brief The QLightReading class represents one reading from the light sensor. diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp index 0e9fcea3..81cb6530 100644 --- a/src/sensors/qsensor.cpp +++ b/src/sensors/qsensor.cpp @@ -78,6 +78,7 @@ QT_BEGIN_NAMESPACE /*! \class qoutputrange \relates QSensor + \inmodule QtSensors \brief The qoutputrange class holds the specifics of an output range. The class is defined as a simple struct. @@ -507,7 +508,7 @@ void QSensor::setDataRate(int rate) Backends have to implement QSensorBackend::isFeatureSupported() to make this work. - \return whether or not the feature is supported if the backend is connected, or false if the backend is not connected. + Returns whether or not the feature is supported if the backend is connected, or false if the backend is not connected. \since 5.0 */ bool QSensor::isFeatureSupported(Feature feature) const diff --git a/src/sensors/qsensorbackend.cpp b/src/sensors/qsensorbackend.cpp index 44865549..304674ee 100644 --- a/src/sensors/qsensorbackend.cpp +++ b/src/sensors/qsensorbackend.cpp @@ -77,7 +77,7 @@ QSensorBackend::~QSensorBackend() This is the backend side of QSensor::isFeatureSupported(). Reimplement this function if the backend supports one of the additional sensor features of QSensor::Feature. - \return whether the feature \a feature is supported by this backend. The default implementation returns false. + Returns whether the feature \a feature is supported by this backend. The default implementation returns false. \since 5.0 */ bool QSensorBackend::isFeatureSupported(QSensor::Feature feature) const diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro index e0c68211..2cb33468 100644 --- a/src/sensors/sensors.pro +++ b/src/sensors/sensors.pro @@ -10,7 +10,7 @@ simulator { QT += simulator } -QMAKE_DOCS = $$PWD/../../doc/config/qtsensors.qdocconf +QMAKE_DOCS = $$PWD/doc/qtsensors.qdocconf load(qt_module) -- cgit v1.2.3