diff options
author | Jaishree Vyas <Jaishree.Vyas@qt.io> | 2023-04-14 15:46:29 +0200 |
---|---|---|
committer | Jaishree Vyas <Jaishree.Vyas@qt.io> | 2023-05-24 08:47:28 +0200 |
commit | f54dc7206a6d637ba0eca7f9fcc9e411423d8750 (patch) | |
tree | e7b16dde94b8c04d499f06d71f106129e8acca4b /src/sensors/doc/src | |
parent | 240156f91a6b607aae738a6fa2fd3acc7b9e578b (diff) |
Tutorial for creating new sensors
Documentation for creating your own sensors
Task-number: QTBUG-111251
Change-Id: Ia747995cff99ba34a41ede4125a433fd7952b628
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/sensors/doc/src')
-rw-r--r-- | src/sensors/doc/src/qtsensors-tutorial.qdoc | 36 | ||||
-rw-r--r-- | src/sensors/doc/src/qtsensors.qdoc | 1 |
2 files changed, 37 insertions, 0 deletions
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 76235bb6..62959fbd 100644 --- a/src/sensors/doc/src/qtsensors.qdoc +++ b/src/sensors/doc/src/qtsensors.qdoc @@ -38,6 +38,7 @@ \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 |