1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QSENSORMANAGER_H |
5 | #define QSENSORMANAGER_H |
6 | |
7 | #include <QtSensors/qsensor.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QSensorBackend; |
12 | class QSensorBackendFactory; |
13 | class QSensorPluginInterface; |
14 | |
15 | class Q_SENSORS_EXPORT QSensorManager |
16 | { |
17 | public: |
18 | // Register a backend (call this from a plugin) |
19 | static void registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory); |
20 | static void unregisterBackend(const QByteArray &type, const QByteArray &identifier); |
21 | |
22 | static bool isBackendRegistered(const QByteArray &type, const QByteArray &identifier); |
23 | |
24 | // Create a backend (uses the type and identifier set in the sensor) |
25 | static QSensorBackend *createBackend(QSensor *sensor); |
26 | |
27 | static void setDefaultBackend(const QByteArray &type, const QByteArray &identifier); |
28 | }; |
29 | |
30 | class Q_SENSORS_EXPORT QSensorBackendFactory |
31 | { |
32 | public: |
33 | virtual QSensorBackend *createBackend(QSensor *sensor) = 0; |
34 | protected: |
35 | virtual ~QSensorBackendFactory(); |
36 | }; |
37 | |
38 | QT_END_NAMESPACE |
39 | |
40 | #endif |
41 | |
42 | |