blob: 147b8504b092e700202144bf3e8e22a75eb1cd39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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.
*/
|