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 QSENSOR_P_H
5#define QSENSOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qsensor.h"
19
20#include "private/qobject_p.h"
21
22QT_BEGIN_NAMESPACE
23
24typedef QList<QSensorFilter*> QFilterList;
25
26class QSensorPrivate : public QObjectPrivate
27{
28 Q_DECLARE_PUBLIC(QSensor)
29public:
30 QSensorPrivate()
31 : identifier()
32 , type()
33 , outputRange(-1)
34 , dataRate(0)
35 , backend(0)
36 , active(false)
37 , busy(false)
38 , device_reading(0)
39 , filter_reading(0)
40 , cache_reading(0)
41 , error(0)
42 , alwaysOn(false)
43 , skipDuplicates(false)
44 , axesOrientationMode(QSensor::AxesOrientationMode::FixedOrientation)
45 , currentOrientation(0)
46 , userOrientation(0)
47 , bufferSize(1)
48 , maxBufferSize(1)
49 , efficientBufferSize(1)
50 {
51 }
52
53 void init(const QByteArray &sensorType);
54
55 // meta-data
56 QByteArray identifier;
57 QByteArray type;
58
59 QString description;
60
61 qoutputrangelist outputRanges;
62 int outputRange;
63
64 // policy
65 qrangelist availableDataRates;
66 int dataRate;
67
68 QSensorBackend *backend;
69 QFilterList filters;
70 bool active;
71 bool busy;
72 QSensorReading *device_reading;
73 QSensorReading *filter_reading;
74 QSensorReading *cache_reading;
75
76 int error;
77
78 bool alwaysOn;
79 bool skipDuplicates;
80
81 QSensor::AxesOrientationMode axesOrientationMode;
82 int currentOrientation;
83 int userOrientation;
84
85 int bufferSize;
86 int maxBufferSize;
87 int efficientBufferSize;
88};
89
90class QSensorReadingPrivate
91{
92public:
93 QSensorReadingPrivate()
94 : timestamp(0)
95 {
96 }
97
98 // sensor data cache
99 quint64 timestamp;
100};
101
102QT_END_NAMESPACE
103
104#endif
105
106

source code of qtsensors/src/sensors/qsensor_p.h