34 QML_NAMED_ELEMENT(SatelliteSource)
35 QML_ADDED_IN_VERSION(6, 5)
37 Q_PROPERTY(
bool active READ isActive WRITE setActive NOTIFY activeChanged)
38 Q_PROPERTY(
bool valid READ isValid NOTIFY validityChanged)
39 Q_PROPERTY(
int updateInterval READ updateInterval WRITE setUpdateInterval
40 NOTIFY updateIntervalChanged)
41 Q_PROPERTY(SourceError sourceError READ sourceError NOTIFY sourceErrorChanged)
42 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
43 Q_PROPERTY(QQmlListProperty<QDeclarativePluginParameter> parameters READ parameters)
44 Q_PROPERTY(QList<QGeoSatelliteInfo> satellitesInUse READ satellitesInUse
45 NOTIFY satellitesInUseChanged)
46 Q_PROPERTY(QList<QGeoSatelliteInfo> satellitesInView READ satellitesInView
47 NOTIFY satellitesInViewChanged)
49 Q_CLASSINFO(
"DefaultProperty",
"parameters")
50 Q_INTERFACES(QQmlParserStatus)
54 AccessError = QGeoSatelliteInfoSource::AccessError,
55 ClosedError = QGeoSatelliteInfoSource::ClosedError,
56 NoError = QGeoSatelliteInfoSource::NoError,
57 UnknownSourceError = QGeoSatelliteInfoSource::UnknownSourceError,
58 UpdateTimeoutError = QGeoSatelliteInfoSource::UpdateTimeoutError,
62 QDeclarativeSatelliteSource();
63 ~QDeclarativeSatelliteSource();
65 bool isActive()
const;
67 int updateInterval()
const;
68 SourceError sourceError()
const;
70 QQmlListProperty<QDeclarativePluginParameter> parameters();
71 QList<QGeoSatelliteInfo> satellitesInUse()
const;
72 QList<QGeoSatelliteInfo> satellitesInView()
const;
74 void setUpdateInterval(
int updateInterval);
75 void setActive(
bool active);
76 void setName(
const QString &name);
79 void classBegin() override { }
80 void componentComplete() override;
82 Q_INVOKABLE
bool setBackendProperty(
const QString &name,
const QVariant &value);
83 Q_INVOKABLE QVariant backendProperty(
const QString &name)
const;
86 void update(
int timeout = 0);
92 void validityChanged();
93 void updateIntervalChanged();
94 void sourceErrorChanged();
96 void satellitesInUseChanged();
97 void satellitesInViewChanged();
100 void sourceErrorReceived(
const QGeoSatelliteInfoSource::Error error);
101 void onParameterInitialized();
102 void satellitesInViewUpdateReceived(
const QList<QGeoSatelliteInfo> &satellites);
103 void satellitesInUseUpdateReceived(
const QList<QGeoSatelliteInfo> &satellites);
106 QVariantMap parameterMap()
const;
107 void createSource(
const QString &newName);
108 void handleSingleUpdateReceived();
110 void executeSingleUpdate(
int timeout);
112 using PluginParameterProperty = QQmlListProperty<QDeclarativePluginParameter>;
113 static void parameter_append(PluginParameterProperty *prop,
114 QDeclarativePluginParameter *parameter);
115 static qsizetype parameter_count(PluginParameterProperty *prop);
116 static QDeclarativePluginParameter *parameter_at(PluginParameterProperty *prop,
118 static void parameter_clear(PluginParameterProperty *prop);
120 std::unique_ptr<QGeoSatelliteInfoSource> m_source;
121 QList<QDeclarativePluginParameter *> m_parameters;
123 int m_updateInterval = 0;
124 SourceError m_error = SourceError::NoError;
126 QList<QGeoSatelliteInfo> m_satellitesInView;
127 QList<QGeoSatelliteInfo> m_satellitesInUse;
129 int m_singleUpdateDesiredTimeout = 0;
132 quint8 m_componentComplete : 1;
133 quint8 m_parametersInitialized : 1;
134 quint8 m_startRequested : 1;
135 quint8 m_defaultSourceUsed : 1;
136 quint8 m_regularUpdates : 1;
137 quint8 m_singleUpdate : 1;
138 quint8 m_singleUpdateRequested : 1;