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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDECLARATIVESATELLITESOURCE_H
#define QDECLARATIVESATELLITESOURCE_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/private/qproperty_p.h>
#include <QtCore/QObject>
#include <QtPositioning/qgeosatelliteinfosource.h>
#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
#include <QtQml/QQmlParserStatus>
QT_BEGIN_NAMESPACE
class Q_POSITIONINGQUICK_EXPORT QDeclarativeSatelliteSource : public QObject, public QQmlParserStatus
{
Q_OBJECT
QML_NAMED_ELEMENT(SatelliteSource)
QML_ADDED_IN_VERSION(6, 5)
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
Q_PROPERTY(bool valid READ isValid NOTIFY validityChanged)
Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval
NOTIFY updateIntervalChanged)
Q_PROPERTY(SourceError sourceError READ sourceError NOTIFY sourceErrorChanged)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QQmlListProperty<QDeclarativePluginParameter> parameters READ parameters)
Q_PROPERTY(QList<QGeoSatelliteInfo> satellitesInUse READ satellitesInUse
NOTIFY satellitesInUseChanged)
Q_PROPERTY(QList<QGeoSatelliteInfo> satellitesInView READ satellitesInView
NOTIFY satellitesInViewChanged)
Q_CLASSINFO("DefaultProperty", "parameters")
Q_INTERFACES(QQmlParserStatus)
public:
enum SourceError {
AccessError = QGeoSatelliteInfoSource::AccessError,
ClosedError = QGeoSatelliteInfoSource::ClosedError,
NoError = QGeoSatelliteInfoSource::NoError,
UnknownSourceError = QGeoSatelliteInfoSource::UnknownSourceError,
UpdateTimeoutError = QGeoSatelliteInfoSource::UpdateTimeoutError,
};
Q_ENUM(SourceError)
QDeclarativeSatelliteSource();
~QDeclarativeSatelliteSource();
bool isActive() const;
bool isValid() const;
int updateInterval() const;
SourceError sourceError() const;
QString name() const;
QQmlListProperty<QDeclarativePluginParameter> parameters();
QList<QGeoSatelliteInfo> satellitesInUse() const;
QList<QGeoSatelliteInfo> satellitesInView() const;
void setUpdateInterval(int updateInterval);
void setActive(bool active);
void setName(const QString &name);
// virtuals from QQmlParserStatus
void classBegin() override { }
void componentComplete() override;
Q_INVOKABLE bool setBackendProperty(const QString &name, const QVariant &value);
Q_INVOKABLE QVariant backendProperty(const QString &name) const;
public Q_SLOTS:
void update(int timeout = 0);
void start();
void stop();
Q_SIGNALS:
void activeChanged();
void validityChanged();
void updateIntervalChanged();
void sourceErrorChanged();
void nameChanged();
void satellitesInUseChanged();
void satellitesInViewChanged();
private Q_SLOTS:
void sourceErrorReceived(const QGeoSatelliteInfoSource::Error error);
void onParameterInitialized();
void satellitesInViewUpdateReceived(const QList<QGeoSatelliteInfo> &satellites);
void satellitesInUseUpdateReceived(const QList<QGeoSatelliteInfo> &satellites);
private:
QVariantMap parameterMap() const;
void createSource(const QString &newName);
void handleSingleUpdateReceived();
void executeStart();
void executeSingleUpdate(int timeout);
using PluginParameterProperty = QQmlListProperty<QDeclarativePluginParameter>;
static void parameter_append(PluginParameterProperty *prop,
QDeclarativePluginParameter *parameter);
static qsizetype parameter_count(PluginParameterProperty *prop);
static QDeclarativePluginParameter *parameter_at(PluginParameterProperty *prop,
qsizetype index);
static void parameter_clear(PluginParameterProperty *prop);
std::unique_ptr<QGeoSatelliteInfoSource> m_source;
QList<QDeclarativePluginParameter *> m_parameters;
int m_updateInterval = 0;
SourceError m_error = SourceError::NoError;
QString m_name;
QList<QGeoSatelliteInfo> m_satellitesInView;
QList<QGeoSatelliteInfo> m_satellitesInUse;
int m_singleUpdateDesiredTimeout = 0;
quint8 m_active : 1;
quint8 m_componentComplete : 1;
quint8 m_parametersInitialized : 1;
quint8 m_startRequested : 1;
quint8 m_defaultSourceUsed : 1;
quint8 m_regularUpdates : 1;
quint8 m_singleUpdate : 1;
quint8 m_singleUpdateRequested : 1;
};
QT_END_NAMESPACE
#endif // QDECLARATIVESATELLITESOURCE_H
|